note 107628 deleted from curl.examples-basic by tularis
| From: | tularis@php.net | Date: | Wed, 22 Feb 2012 21:06:37 +0000 |
| Subject: | note 107628 deleted from curl.examples-basic by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186300@lists.php.net to get a copy of this message | ||
Note Submitter: hoang92bn at gmail dot com
----
<?php
function getcontent($surl)
{
$header_array[0] = "Keep-Alive: 30000";
$header_array[1] = "Connection: Keep-Alive";
$header_array[2] = "Expect:";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1
(ax)";
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL,$surl);
curl_setopt($ch1, CURLOPT_HEADER,0);
curl_setopt($ch1, CURLOPT_HTTPHEADER,$header_array);
curl_setopt($ch1, CURLOPT_USERAGENT,$agent);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch1,CURLOPT_CONNECTTIMEOUT,"1200");
curl_setopt($ch1, CURLOPT_COOKIEFILE,'cookie.txt');
$result1= curl_exec($ch1);
curl_close ($ch1);
return $result1;
}
?>