02-28-2008, 02:59 AM
|
#4 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,267
Thanks: 90
|
Some websites check to ensure that the user agent HTTP header is set. Every browser will set a user agent, unless home-made, and so if that's not set then it's a tell tale sign of a robot, not a person using a browser. To get around that use cURL and set the user agent.
php Code:
$szURL = 'http://www.talkphp.com/'; $szUserAgent = 'Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101';
$pCurl = curl_init($szURL);
curl_setopt($pCurl, CURLOPT_RETURNTRANSFER, true); curl_setopt($pCurl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($pCurl, CURLOPT_USERAGENT, $szUserAgent);
$szContent = curl_exec($pCurl);
curl_close($pCurl);
die($szContent);
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|