note 28758 deleted from ref.curl by betz
| From: | betz@php.net | Date: | Fri, 23 Apr 2004 08:44:14 +0000 |
| Subject: | note 28758 deleted from ref.curl by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68587@lists.php.net to get a copy of this message | ||
Note Submitter: jobob AT yahoo.com
----
There is a site which uses curl to do a lot of automated link checking in a script is <a
href="http://listbid.com/affil/>affiliate
source</a> which seems to be pretty interesting in the script they use. Here is a modified
version.
function GetCurlPage ($pageSpec) {
if(function_exists('curl_init'){
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
$ref = "http://listbid.com/affil/";
$ch = curl_init($pageSpec);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $ref);
$tmp = curl_exec ($ch);
curl_close ($ch);
$ret = $tmp;
}else{
$ret = @implode('', @file ($pageSpec));
}
return $ret;
}
This check if CURL is installed first before attempting to call it, this is for those of you who are
not sure if it is. (shared hosting etc.)
cheers