PHP cURL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// initialize cURL $ch = curl_init(); // set the URL of the remote resource to download curl_setopt($ch, CURLOPT_URL, 'http://www.site.com/index.html'); //set url as curl_init() parameter --> $ch = curl_init('http://www.site.com/index.html'); // required that no headers be downloaded curl_setopt($ch, CURLOPT_HEADER, 0); // prevent remote content from being passed to print curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // set the timeout to 10 seconds curl_setopt($ch, CURLOPT_TIMEOUT, 10); // run the call and save the result in a variable $output = curl_exec($ch); // close cURL curl_close($ch); |