Problem with fopen opening a URL
Posted: Sat Nov 15, 2003 9:52 pm
I'm trying to fopen a URL as follows:
$fp = fopen($work_string, "r");
The fopen is failing wih a 'unable to open stream' HTTP 400 - Bad Request
If I copy the contents of $work_string and paste it into Internet Explorer - it works I get the XML response back correctly.
If I change $work_string to something simple such as http://www.microsoft.com with no additional parameters, then the fopen works fine.
The contents of $work_string are as follows:
$work_string = 'http://testing.shippingapis.com/Shippin ... ateRequest USERID="myuserid" PASSWORD="mypassword"><Package ID="0"><Service>EXPRESS</Service><ZipOrigination>20770</ZipOrigination><ZipDestination>20852</ZipDestination><Pounds>10</Pounds><Ounces>0</Ounces><Container>None</Container><Size>REGULAR</Size><Machinable></Machinable></Package></RateRequest>';
I'm using Apache 2.0.48 and PHP 4.3.4 in Windows XP.
I've temporarily changed the code to use fsockopen and got it to work - but I really want to get this fopen to work - or at least an understanding why it is failing.
Thanks
David
$fp = fopen($work_string, "r");
The fopen is failing wih a 'unable to open stream' HTTP 400 - Bad Request
If I copy the contents of $work_string and paste it into Internet Explorer - it works I get the XML response back correctly.
If I change $work_string to something simple such as http://www.microsoft.com with no additional parameters, then the fopen works fine.
The contents of $work_string are as follows:
$work_string = 'http://testing.shippingapis.com/Shippin ... ateRequest USERID="myuserid" PASSWORD="mypassword"><Package ID="0"><Service>EXPRESS</Service><ZipOrigination>20770</ZipOrigination><ZipDestination>20852</ZipDestination><Pounds>10</Pounds><Ounces>0</Ounces><Container>None</Container><Size>REGULAR</Size><Machinable></Machinable></Package></RateRequest>';
I'm using Apache 2.0.48 and PHP 4.3.4 in Windows XP.
I've temporarily changed the code to use fsockopen and got it to work - but I really want to get this fopen to work - or at least an understanding why it is failing.
Thanks
David