Reply to Re: file_get_contents outputs nothing

Your name:

Reply:


Posted by Rik Wasmus on 10/25/07 19:02

On Thu, 25 Oct 2007 16:46:07 +0200, Taras_96 <taras.di@gmail.com> wrote:=


> Hi everyone,
>
> The output of
>
> echo file_get_contents("http://watchout4snakes.com/creativitytools/
> RandomWord/RandomWordPlus.aspx");
>
> leaves the browser empty.. no error messages, nothing.
>
> Why is this occurring?

It's a badly designed website/server, which apparently applies browser =

sniffing of some sort. You'll have to mimique a common UA with for =

instance CURL to get it to output anything. This works:

<?php
$ch =3D curl_init();

curl_setopt($ch, CURLOPT_URL, =

"http://watchout4snakes.com/creativitytools/RandomWord/RandomWordPlus.as=
px");
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT =

5.2; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7');

curl_exec($ch);
curl_close($ch);
?>

... without setting the CURLOPT_USERAGENT the site indeed outputs nothing=
..
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация