Jump to content

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!

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.