Jump to content

DOMDocument and http version help


shelluk

Recommended Posts

Hi

 

I'm exploring the DOMDocument class for the first time to do some screen scraping. I am getting the following error though:

 

PHP Warning: DOMDocument::loadHTMLFile(https://192.168.1.59/): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported\r\n in /var/www/default/path/file.php on line 25
PHP Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https%3A%2F%2F192.168.1.59%2F" in /var/www/default/path/file.php on line 25

 

I've tried adding urlencode() as I saw it suggested in a few places but had no luck (and didn't expect it to help as there is nothing fancy is in the URL?).

 

$url = urlencode('https://192.168.1.59/');

$doc = new DOMDocument();
$doc->loadHtmlFile( $url );
$xpath = new DOMXPath( $doc );
$nodelist = $xpath->query( "/html/body/div[@class='applicationPalette']/table/tbody/tr[2]/td[@class='rightContentPane']/div[@class='pad10'][1]/table/tbody/tr[2]/td[@class='itemLargeFont']" );

 

I think I need to force HTTP 1.0 but I'm failing at working out how. Or am I wrong all together and it's something else?

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/272850-domdocument-and-http-version-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.