-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
35 lines (25 loc) · 1.11 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
// CURL Extension Emulation Library Example
//
// Usage should be straightforward; you simply use this script exactly as you
// would normally use the PHP CURL extension functions.
// first, include libcurlemu.inc.php
require_once('libcurlemu.inc.php');
// at this point, libcurlemu has detected the best available CURL solution
// (either the CURL extension, if available, or the CURL commandline binary,
// if available, or as a last resort, HTTPRetriever, our native-PHP HTTP
// client implementation) and has implemented the curl_* functions if
// necessary, so you can use CURL normally and safely assume that all CURL
// functions are available.
// the rest of this example code is copied straight from the PHP manual's
// reference for the curl_init() function, and will work fine with libcurlemu
// create a new CURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, false);
// grab URL and pass it to the browser
curl_exec($ch);
// close CURL resource, and free up system resources
curl_close($ch);
?>