#21322 [NEW]: Out Put Error from United Parcel Service Rate/Service CGI File
| From: | webmaster at crescentart dot com | Date: | Wed, 01 Jan 2003 21:39:10 +0000 |
| Subject: | #21322 [NEW]: Out Put Error from United Parcel Service Rate/Service CGI File | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-28889@lists.php.net to get a copy of this message | ||
From: webmaster@crescentart.com
Operating system: Red Hat Linux 7.1
PHP version: 4.3.0
PHP Bug Type: Output Control
Bug description: Out Put Error from United Parcel Service Rate/Service CGI File
Version 4.3.0 has the following problem.
I have develpoed a script that works with the www.ups.com cgi script to
calculate a shipping rate. The script is having trouble outputing the
entire "string" that is out puted by the
http://www.ups.com/using/services/rave/qcost_dss.cgi
file. I have been
using this script for two years and have never had this problem.
##This is a pre-configured United Parcel Service script.##
<?
//Strings for the shipping calculator.
$codes = "POST /using/services/rave/qcost_dss.cgi HTTP/1.0\n";
$codes .= "Content-type: application/x-www-form-urlencoded\n";
$codes .= "Content-length: 271\n\n";
$codes .= "AppVersion=1.2&";
$codes .= "AcceptUPSLicenseAgreement=YES&";
$codes .= "ResponseType=application/x-ups-rss&";
$codes .= "ActionCode=3&";
$codes .= "ServiceLevelCode=GND&";
$codes .= "RateChart=Regular+Daily+Pickup&";
$codes .= "ShipperPostalCode=48235&";
$codes .= "ConsigneePostalCode=48221&";
$codes .= "ConsigneeCountry=US&";
$codes .= "PackageActualWeight=1&";
$codes .= "ResidentialInd=0&";
$codes .= "PackagingType=00\n\n";
//Open a socket to ups.com to get shipping rates.
$open_sock = fsockopen("www.ups.com",80, $errno, $errstr,10);
if(!($open_sock)){
die("Can not open Socket");
}
else {
while(!(feof($open_sock))){
fputs($open_sock, $codes);
while($line = fgets($open_sock, 1000)){
$contents .= $line;
$check_out_find_rate = explode("%", $contents);
break;
}
}
}
//if the shipping rate can not be found the script dies and directs the
user to a error page.
if($check_out_find_rate[14] == false){
fclose($open_sock);
die("$codes <br><br> $contents");
}
else{
echo "$contents";
fclose($open_sock);
}
?>
######Normaly this script out puts the following stings.####
HTTP/1.1 200 OK
Server: Netscape-Enterprise/6.0
Date: Sun, 15 Dec 2002 04:21:03 GMT
Content-type: multipart/mixed;boundary=UPSBOUNDARY
Content-length: 267
Connection: close
POST /using/services/rave/qcost_dss.cgi HTTP/1.0
Content-type: application/x-www-form-urlencoded
Content-length: 270
AppVersion=1.2&AcceptUPSLicenseAgreement=YES&ResponseType=application/x-ups-rss&ActionCode=3&ServiceLevelCode=GND&RateChart=Regular+Daily+Pickup&ShipperPostalCode=55428&ConsigneePostalCode=48235&ConsigneeCountry=US&PackageActualWeight=2&ResidentialInd=0&PackagingType=00
<HTML>
<BODY>
</BODY>
</HTML>
--UPSBOUNDARY
Content-type: application/x-ups-rss
Content-length: 78
UPSOnLine%1.2%0000%0000Success%3%GND%55428%US%48235%US%004%2%3.92%0.00%3.92%-1
--UPSBOUNDARY--
#####Notice that 3.92 is the actual shipping rate.#####
PHP Version 4.3.0 only out puts the first line which is:
HTTP/1.1 200 OK
I love PHP but version 4.3.0 is very bugy. Please fix this bug.
--
Edit bug report at http://bugs.php.net/?id=21322&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21322&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21322&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21322&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21322&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21322&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21322&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21322&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21322&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21322&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21322&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21322&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21322&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21322&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21322&r=gnused