PHP
--
Questions
--
Followers
Top Experts
https://www.experts-exchange.com/questions/26416747/Trouble-receiving-WebService-SOAP-XML-response-in-PHP.html
The program works fine on a WIn XP system.
It is not running on a CentOS linux server.
I installed the php-soap package on the linux server as follows:
yum install php-soap
(Then restarted apache. Even restarted the server)
I have the following 2 files in the /var/www/html/topup folder in the Linux server:
ServiceManager.php
topup6.php
These two files are attached ServiceManager.php ServiceManager.php topup6.php
I run the program as follows:
http://<ip addr of linux server>/topup/topup6.php
when I run the program, I do not see anything displayed in the browser window.
I ran wireshark and there is NO communication related to soap calls - the soap requests are not being sent out.
The same program works fine from my winxp system.
Please review and advise.
Thanks
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
<?php
error_reporting(-1); // Show everything going wrong.
ini_set('display_errors', 1); // Display them.
set_time_limit(0); // Take forever.
to the top of the topup6.php script.
And then can you run it from the command line.
Can you also edit the php.ini file so that ...
display_startup_errors = 1
Now, we will see if there are any startup errors which would be missed from a web interface.
*********** Console Output ***********
[root@asterisk1 topup]# php -f "topup6.php"
lPHP Warning: SoapClient::__construct(http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL):
Warning: SoapClient::__construct(http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL):
PHP Warning: SoapClient::__construct():
Warning: SoapClient::__construct():
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL' in /var/www/html/topup/Servic
Request Headers
---------------
PHP Notice: Undefined variable: sm in /var/www/html/topup/topup6
Notice: Undefined variable: sm in /var/www/html/topup/topup6
PHP Fatal error: Call to a member function __getLastRequestHeaders() on a non-object in /var/www/html/topup/topup6
Fatal error: Call to a member function __getLastRequestHeaders() on a non-object in /var/www/html/topup/topup6
[root@asterisk1 topup]#
**************************
I have the following settings in php.ini
allow_url_fopen = On
; user_agent="PHP"
(The user_agent setting is commented out. In the WIn XP system, where this script runs successfully, have the same settings)
At the command prompt can you type ...
php -r "echo file_get_contents('http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL');"
I get the wsdl file.
At this stage, I'm guessing it isn't PHP that's the issue, but the server setup.
And I'm a Windows guy ...






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
We are reviewing the configuration of the Linux server.
Please standby while we resolve this network config issue on our linux server
php -r "echo file_get_contents('http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL');"
PHP Warning: file_get_contents(http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL): failed to open stream: HTTP request failed! in Command line code on line 1
However we are able to use the browser to browse various sites.
Please advise.
I don't know unix/lunix at all at this level.
But, if it was windows, I'd now be running Wireshark to see if my requests are even getting to the network. I don't know which end of the connection is doing the blocking.
Can you use PHP to talk to ANY site?
php -r "echo file_get_contents('http://www.experts-exchange.com');"
for example?
Can you also try ...
php -n -r "echo file_get_contents('http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL');"
Is there a non-standard setting in your config getting in the way?

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
wget is such a tool
wget -d https://www.experts-exchange.com
output below.
DEBUG output created by Wget 1.12 on cygwin.
URI encoding = `UTF-8'
--2010-09-29 10:32:28-- http://www.experts-exchange.com/
Resolving www.experts-exchange.com (www.experts-exchange.com)... 64.156.132.140
Caching www.experts-exchange.com => 64.156.132.140
Connecting to www.experts-exchange.com (www.experts-exchange.com)|64.156.132.140|:80... connected.
Created socket 3.
Releasing 0x00902fa0 (new refcount 1).
---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.12 (cygwin)
Accept: */*
Host: www.experts-exchange.com
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Via: 1.1 BV-VM-SVR-17
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 58033
Date: Wed, 29 Sep 2010 09:34:11 GMT
Content-Type: text/html;charset=UTF-8
Server: Apache-Coyote/1.1
Set-Cookie: EETABBEDMENU=; Domain=.experts-exchange.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
Set-Cookie: JSESSIONID=93DA802D60A349F8B34588E1EC06F7AA; Path=/
Set-Cookie: JSESSIONID=93DA802D60A349F8B34588E1EC06F7AA; Domain=.experts-exchange.com; Path=/
Cache-Control: private
P3P: policyref="http://www.experts-exchange.com/policies/p3p.xml", CP="NOI IVA IVD OUR IND UNI"
X-Cache: MISS from www.experts-exchange.com
Keep-Alive: timeout=3, max=10000
---response end---
200 OK
cdm: 1 2 3 4 5 6 7 8
Stored cookie www.experts-exchange.com -1 (ANY) / <session> <insecure> [expiry none] JSESSIONID 93DA802D60A349F8B34588E1EC06F7AA
cdm: 1 2 3 4 5 6 7 8
Stored cookie experts-exchange.com -1 (ANY) / <session> <insecure> [expiry none] JSESSIONID 93DA802D60A349F8B34588E1EC06F7AA
Registered socket 3 for persistent reuse.
URI content encoding = `UTF-8'
Length: 58033 (57K) [text/html]
Saving to: `index.html.4'
100%[==============================================================================================================================================================>] 58,033 73.3K/s in 0.8s
2010-09-29 10:32:29 (73.3 KB/s) - `index.html.4' saved [58033/58033]
Test 1 - Output of wget
===================
# wget -d https://www.experts-exchange.com
DEBUG output created by Wget 1.11.4 Red Hat modified on linux-gnu.
--2010-09-29 13:21:01-- https://www.experts-exchange.com/
Resolving https://www.experts-exchange.com... 64.156.132.140
Caching https://www.experts-exchange.com => 64.156.132.140
Connecting to www.experts-exchange.com|64.156.132.140|:80... connected.
Created socket 3.
Releasing 0x0952af48 (new refcount 1).
---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.11.4 Red Hat modified
Accept: */*
Host: https://www.experts-exchange.com
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Date: Wed, 29 Sep 2010 17:21:10 GMT
Server: Apache-Coyote/1.1
Set-Cookie: EETABBEDMENU=; Domain=.experts-exchange.c
Set-Cookie: JSESSIONID=EEDB2FFC0A1661F
Set-Cookie: JSESSIONID=EEDB2FFC0A1661F
Cache-Control: private
P3P: policyref="https://www.experts-exchange.com/policies/p3p.xml", CP="NOI IVA IVD OUR IND UNI"
Content-Type: text/html;charset=UTF-8
Content-Length: 58181
X-Cache: MISS from https://www.experts-exchange.com
Keep-Alive: timeout=3, max=10000
Connection: Keep-Alive
---response end---
200 OK
Registered socket 3 for persistent reuse.
cdm: 1 2 3 4 5 6 7 8
Stored cookie https://www.experts-exchange.com -1 (ANY) / <session> <insecure> [expiry none] JSESSIONID EEDB2FFC0A1661FAFEA3E2931C
cdm: 1 2 3 4 5 6 7 8
Stored cookie experts-exchange.com -1 (ANY) / <session> <insecure> [expiry none] JSESSIONID EEDB2FFC0A1661FAFEA3E2931C
Length: 58181 (57K) [text/html]
Saving to: `index.html'
100%[=====================
2010-09-29 13:21:04 (29.2 KB/s) - `index.html' saved [58181/58181]
Test 2 - Output of php command line
==========================
# php -r "echo file_get_contents('http://www.experts-exchange.com');"
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: HTTP request failed! in Command line code on line 1
[WIRESHARK does NOT ahow any network activiy from the linux server after the above command is issued]
Test 3
=====
# php -n -r "echo file_get_contents('http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL');"
Warning: file_get_contents(http://stage.valuetopup.com/posaservice/servicemanager.asmx?WSDL): failed to open stream: HTTP request failed! in Command line code on line 1
#
[WIRESHARK does NOT ahow any network activiy from the linux server after the above command is issued]
So, firewall wise, everything is OK.
No activity in Wireshark firmly plants the blame with PHP.
Hmm..
Can you try this ...
php -d allow_url_fopen=1 -r "echo file_get_contents('http://www.e-e.com');"
If I set the value to 0, on my setup (PHP 5.3.2), I get ...
php -d error_reporting=-1 -d display_errors=1 -d display_startup_errors=1 -d allow_url_fopen=0 -r "echo file_get_contents('http://www.e-e.com');"
Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in Command line code on line 1
Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: no suitable wrapper could be found in Command line code on line 1
With = 1, all OK.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
"If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail."
The note above applies to all fopen style functions.
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: HTTP request failed! in Command line code on line 1
(This works fine on windows system)
# php -d allow_url_fopen=0 -r "echo file_get_contents('http://www.e-e.com');"
PHP Warning: file_get_contents(): URL file-access is disabled in the server configuration in Command line code on line 1
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: no suitable wrapper could be found in Command line code on line 1
So not allow_url_fopen.
Can you send me the output to
php -i
please.
If you have any private values set there (username, passwords, etc.) can you replace them with [EDITED].

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I've placed a question on the PHP General list - http://news.php.net/php.general/308364
I'll keep you informed.
Are you able to reinstall PHP without the SOAP element and try the command line tests?
You are using PHP 5.1.6. If you could upgrade PHP to the latest version (I use a dev release of 5.3.4-dev, so 5.3.3 is the last official release).
yum erase php-soap
==================
Running Transaction
Erasing : php-soap 1/1
Removed:
php-soap.i386 0:5.1.6-27.el5
Complete!
2. Attempted to update PHP
Package php-5.1.6-27.el5.i386 already installed and latest version
Nothing to do
3. php -d allow_url_fopen=1 -r "echo file_get_contents('http://www.e-e.com');"
==========================
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: HTTP request failed! in Command line code on line 1
(NO Activity in Wireshark)
4. php -d allow_url_fopen=0 -r "echo file_get_contents('http://www.e-e.com');"
==========================
PHP Warning: file_get_contents(): URL file-access is disabled in the server configuration in Command line code on line 1
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: no suitable wrapper could be found in Command line code on line 1
5. php -r "echo file_get_contents('http://www.experts-exchange.com');"
==========================
php -r "echo file_get_contents('http://www.experts-exchange.com');"
PHP Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: HTTP request failed! in Command line code on line 1
6. wget output is fine






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
So ...
php -n -d allow_url_fopen=1 -r "echo file_get_contents('http://www.e-e.com');"
Warning: file_get_contents(https://www.experts-exchange.com): failed to open stream: HTTP request failed! in Command line code on line 1
I will place the server outside the firewall and do the test. Please give me a day or so to arrange for this test.
Good luck.
If this isn't the issue, then I think you'll need to request attention and ask to include zones relating to CentOS and PHP Installation.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I had a similar issue with PHP on a windows network using NTLM authentication.
Couldn't do the NTLM authentication in PHP, so used the NTLMAPS (NTLM Authentication Proxy Server) - a Python based proxy from Sourceforge (http://ntlmaps.sourceforge.net/). Added a few patches to keep the credentials secure.
If this is the case, take a look at my user note http://docs.php.net/manual/en/function.stream-context-get-default.php#72086
This may help. The code shown was used for several years before we changed our network.
On windows, the default gateway, as reported by IPCONFIG /all, is now correct and we don't have NTLM authentication. Instead we have Active Directory doing it for us, so the firewall knows we are authenticated users (I think - I'm not a sysop).
'stream_context' => stream_context_get_default
to the options of the soap request.
If proxy is the issue, then ...
http://proxychains.sourceforge.net/
Not my forte unfortunately, I'm only passing on this one.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I put the linux server completely outside the firewall and it works file. I have the SonicWall as the firewall. The WinXP is also behind the same firewall and does not have the issue. The linux server does.
Your comment is the box 09/30/10 05:03 PM, ID: 33803526 has resolved the problem.
Thankyou very much for your help in resolving this issue.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I was just acting as a conduit.
PHP
--
Questions
--
Followers
Top Experts
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.