file_get_html error on one site
Posted: Sat Sep 03, 2011 11:58 am
I'm using simple html dom parser.
I used it in my web site successfully.
But i changed my host company and i can't run my existing codes.
"file_get_html" works on some sites. doesn't work on some sites.
i couldn't understand the problem.
This one works:
Although web site can be opened from my browser, This one doesn't work in php script:
-----------------------------
The same problem occurs again when i use in object oriented way.
Works:
Doesn't work:
The error is:
Warning: file_get_contents(http://www.eksisozluk.com) [function.file-get-contents]: failed to open stream: HTTP request failed! in /home/mysite/public_html/myfolder/simple_html_dom.php on line 850
Fatal error: Call to a member function innertext() on a non-object in /home/mysite/public_html/myfolder/simple_html_dom.php on line 1364
I used it in my web site successfully.
But i changed my host company and i can't run my existing codes.
"file_get_html" works on some sites. doesn't work on some sites.
i couldn't understand the problem.
This one works:
Code: Select all
include_once ('simple_html_dom.php');
$html1 = file_get_html('http://www.yahoo.com');
echo $html1;Although web site can be opened from my browser, This one doesn't work in php script:
Code: Select all
include_once ('simple_html_dom.php');
$html2 = file_get_html('http://www.eksisozluk.com');
echo $html1;The same problem occurs again when i use in object oriented way.
Works:
Code: Select all
$html1 = new simple_html_dom();
$address1='http://www.yahoo.com';
$html1->load_file($address1);
echo "$html1";Code: Select all
$html2 = new simple_html_dom();
$address2='http://www.eksisozluk.com';
$html2->load_file($address2);
echo "$html2";The error is:
Warning: file_get_contents(http://www.eksisozluk.com) [function.file-get-contents]: failed to open stream: HTTP request failed! in /home/mysite/public_html/myfolder/simple_html_dom.php on line 850
Fatal error: Call to a member function innertext() on a non-object in /home/mysite/public_html/myfolder/simple_html_dom.php on line 1364