Page 1 of 1

problem in retrieving pages' contents using file_get_content

Posted: Wed Oct 21, 2009 8:14 pm
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

Re: problem in retrieving pages' contents using file_get_content

Posted: Wed Oct 21, 2009 8:23 pm
by requinix
What is the exact URL you're trying?

Re: problem in retrieving pages' contents using file_get_content

Posted: Wed Oct 21, 2009 9:23 pm
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

Re: problem in retrieving pages' contents using file_get_content

Posted: Wed Oct 21, 2009 11:53 pm
by requinix
The search results are generated using JavaScript.
PHP cannot execute JavaScript.

Find another way. Tip: use a different URL.

Re: problem in retrieving pages' contents using file_get_content

Posted: Thu Oct 22, 2009 3:17 am
by Mehnaz
I have to scarpe the results only from this site .Any solution even by using Javascript ?