|
Posted by Jacob Atzen on 08/28/05 13:18
On 2005-08-26, Basta <baspellis@gmail.com> wrote:
> I'm trying to retrieve information of a website using PHP and Curl.
> This is the code I use:
>
><?
> $tturl = "http://teletekst.nos.nl/";
> echo "opening $tturl ...\n";
> $ch = curl_init();
> if (! $ch) die( "Cannot allocate a new PHP-CURL handle\n" );
> $fp = fopen("ttread.htm", "w");
> curl_setopt($ch, CURLOPT_FILE, $fp);
> curl_setopt($ch, CURLOPT_URL, $tturl);
> curl_exec($ch);
> curl_close($ch);
> fclose($fp);
> echo "finished\n";
> ?>
>
> This results in a 403 forbidden page. However if I type the url
> http://teletekst.nos.nl/ in my browser then it works fine (also with
> cookies disabled). If I change $tturl in the script to
> http://www.nos.nl/ itw works. What is teh difference between typing
> itin my browser or accessing it with curl? Is tehere a workaround for
> this?
Perhaps it checks on user-agent?
--
Cheers,
- Jacob Atzen
Navigation:
[Reply to this message]
|