Bug #76330 [Com]: XPath only works in a linux server not local windows IIS
| From: | a at b dot c dot de | Date: | Sun, 13 May 2018 00:11:39 +0000 |
| Subject: | Bug #76330 [Com]: 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-215234@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
Comment by: a at b dot c dot de
Reported by: kj-8791 at hotmail dot com
Summary: XPath only works in a linux server not local windows
IIS
Status: Not a bug
Type: Bug
Package: *XML functions
Operating System: windows 10 enterprise
PHP Version: 7.2.5
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
They may also already provide you with what you're wanting already prepackaged.
https://www.investing.com/webmaster-tools/technical-summary
Previous Comments:
------------------------------------------------------------------------
[2018-05-12 10:22:03] cmb@php.net
> 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.
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
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