problem in retrieving pages' contents using file_get_content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mehnaz
Forum Newbie
Posts: 20
Joined: Mon Jun 02, 2008 7:49 pm

problem in retrieving pages' contents using file_get_content

Post by Mehnaz »

Hi ,

I have to scarpe a search engine .I tried this

Code: Select all

 
 <?php
$hon_html_file = file_get_contents("http://www.hon.ch/HONcode/Search/search.html?cref=http%3A%2F%2Fwww.hon.ch%2FHONcode%2FSearch%2FHONcodeHunt%2Fcontextlink.xml&q=".$urlnew."&hl=en&cof=FORID%3A11#997");
 
echo $hon_html_file;
?>
 
but it does not echo page with its contents b/c it is not in the source as well. I tried to use curl as well but the result is same.

Please help . I want to grab the title and urls of first ten retirvied results.

Thanks
Mehnaz
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem in retrieving pages' contents using file_get_content

Post by requinix »

What is the exact URL you're trying?
Mehnaz
Forum Newbie
Posts: 20
Joined: Mon Jun 02, 2008 7:49 pm

Re: problem in retrieving pages' contents using file_get_content

Post by Mehnaz »

i am trying this url

http://www.hon.ch/HONcode/Search/search ... D%3A11#997

when I just paste the url in browser it works but not with echo file_get_contents();

Mehnaz
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem in retrieving pages' contents using file_get_content

Post by requinix »

The search results are generated using JavaScript.
PHP cannot execute JavaScript.

Find another way. Tip: use a different URL.
Mehnaz
Forum Newbie
Posts: 20
Joined: Mon Jun 02, 2008 7:49 pm

Re: problem in retrieving pages' contents using file_get_content

Post by Mehnaz »

I have to scarpe the results only from this site .Any solution even by using Javascript ?
Post Reply