Reply to Re: file_get_contents outputs nothing

Your name:

Reply:


Posted by Taras_96 on 10/26/07 04:59

On Oct 26, 3:02 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 25 Oct 2007 16:46:07 +0200, Taras_96 <taras...@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 = curl_init();
>
> curl_setopt($ch, CURLOPT_URL,
> "http://watchout4snakes.com/creativitytools/RandomWord/RandomWordPlus....");
> 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

Yep, that would do the trick :D

Thanks all for your suggestions

Taras

[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

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