View Full Version : http request problem

07-10-2008, 05:47 AM
I have to pass a post variable to one page and get back the value though http request.
I tried to make request to some page like yahoo.com. It's success for me to use the fsockopen function.

$URL = "http://www.yahoo.com";
$fp = fsockopen($URL_Info["host"],80,$errno,$errstr,10);

it's success for yahoo.com

However, it failed to make connection to one .jsp page which is:

Fail example:
$failURL = "http://www.xxxxx.com/jsp/yyyy.jsp";
$URL_Info=parse_url($failURL );
$fp = fsockopen($URL_Info["host"],80,$errno,$errstr,10);

it failed.
besides, it works when I submit the form directly to this page(NOT the http request).

What 's the possible problem on it? How can I debug?@@

And also, I found it failed to access the root of $failURL, which is 'www.xxxxx.com' . Is it the problem on this situation?


07-12-2008, 05:31 AM
How does the POST variable come into all this? As far as I can see, fsockopen doesn't pass POST data...

When the connection to the JSP page failed, did you get any errors? (Use error_reporting(E_ALL | E_STRICT); at the top of your script to see all errors, warnings, etc.)