Bug #76330 [Opn->Nab]: XPath only works in a linux server not local windows IIS

From: Date: Sat, 12 May 2018 10:22:08 +0000
Subject: Bug #76330 [Opn->Nab]: XPath only works in a linux server not local windows IIS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215229@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76330&edit=1 ID: 76330 Updated by: cmb@php.net Reported by: kj-8791 at hotmail dot com Summary: XPath only works in a linux server not local windows IIS -Status: Open +Status: Not a bug Type: Bug Package: *XML functions Operating System: windows 10 enterprise PHP Version: 7.2.5 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > added in index.php > libxml_use_internal_errors(true); shows forbidden so i added > ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)'); and it works So this is not XPath related; actually, it is not even a bug in PHP. You always have to properly check the return values for failures. > useragent should be added as default in php.ini No. Instead you may think about *why* the site responds with 403 Forbidden, if no User-Agent is sent. Hint: likely the site owners don't want their site to be scraped by arbitrary bots. Previous Comments: ------------------------------------------------------------------------ [2018-05-11 17:40:05] kj-8791 at hotmail dot com Thanks for help i have solved it as i found solution in https://stackoverflow.com/questions/22734182/403-error-when-using-file-get-contents added in index.php libxml_use_internal_errors(true); shows forbidden so i added ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)'); and it works but it does not answer why it is working in linux, useragent should be added as default in php.ini hopefully this workaround helps other people if this is mention somewhere in FAQ ------------------------------------------------------------------------ [2018-05-11 16:37:36] kj-8791 at hotmail dot com Yes i have tried strlen($data) and shows 0 i have found error settings in php.ini and changed it to "ON" and it shows now errors Notice: Trying to get property 'nodeValue' of non-object in D:\Server\test\app\signal-eurusd\index.php on line 8 but it works in mzzhost.com and uses linux so it is strange... for more information i have checked this problem since windows 10 come out and updated both system and php many times to see if this is a windows bug, it is not high level bug as linux works, but it is good if this would be fixed so it works in all systems, i can think that XPath doesn't work at all in windows because some security restrictions but google has no information how to fix that ------------------------------------------------------------------------ [2018-05-11 15:57:48] peehaa@php.net Are you sure $data is actually null or do you get a fatal error? ------------------------------------------------------------------------ [2018-05-11 15:36:28] kj-8791 at hotmail dot com retrive from @id="technical_summary_container"]/table/tbody/tr[3]/td[2] # should show one of this and it does in linux but not in windows # Strong Sell Sell Neutral Buy Strong Buy ------------------------------------------------------------------------ [2018-05-11 15:31:22] kj-8791 at hotmail dot com Yes i have removed @ and it doesn't show anything, totally empty when checking the page direct i only see a white page, when i use http request from javascript from another page to retrive "xpath page" is shows undefined, but this is only in a local windows 10 testing enviroment, if i upload to a linux server it works, but it should work locally as i use webserver IP not localhost as i have read that localhost have security limits when retriveng data from another server on internet i can retrive all other pages so webserver works ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=76330 -- Edit this bug report at https://bugs.php.net/bug.php?id=76330&edit=1

« previous php.bugs (#215229) next »