Jump to content
torinwalker

New UPS XML Shipping Module available

Recommended Posts

Steve, Gabor,

 

Can you also add something to checkout_shipping.php to see if the UPS XML returned anything to give checkout_shipping something to work with?

 

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<?php 
? ? ? ? ? ?print ("<pre>\$quotes is: ");
? ? ? ? ? ?print_r($quotes[0]['methods']);
// use exit at first, can also be commented out later to keep a tab on quotes while
// the page is outputted below it.
? ? ? ? ? ?exit;
? ? ? ? ?
?>
<!-- header //-->

 

You should see something like:

$quotes is: Array
(
? ?[0] => Array
? ? ? ?(
? ? ? ? ? ?[id] => UPS Worldwide Express
? ? ? ? ? ?[title] => UPS Worldwide Express, 2004-12-22
? ? ? ? ? ?[cost] => 61.02
? ? ? ?)

)

 

 

Hi Janz,

 

I've added the above lines but still get the blank page... I wonder is my configuration problem in php.ini? My machine is running on Windows 2003 server and PHP Version 4.3.9. I've just downloaded and installed expat_win32bin v1.95.8 and installed under c:\php\Expat-1.95.8. I didn't get any error or text displayed in checkout_shipping.php.

 

Please help!

 

Regards

Steve

Share this post


Link to post
Share on other sites
Hi Steve!

 

I have this configuration (see bellow). Do not forget to install the XML parser php-xml (see my previoue reply).

G.

 

United Parcel Service (XML)

 

Enable UPS Shipping

True

 

UPS Rates Access Key

**************************

 

UPS Rates Username

**************************

 

UPS Rates Password

**************************

 

Pickup Method

Daily Pickup

 

Packaging Type

Customer Package

 

Customer Classification Code

03

 

Shipping Origin

Canada Origin

 

Origin City

Calgary

 

Origin State/Province

AB

 

Origin Country

CA

 

Origin Zip/Postal Code

T2E8M5

 

Test or Production Mode

Test

 

Unit Weight

KGS

 

Unit Length

CM

 

Quote Type

Commercial

 

Handling Fee

0

 

Tax Class

--none--

 

Shipping Zone

--none--

 

Sort order of display.

0

 

Shipping Methods

Next Day Air, 2nd Day Air, Ground, Worldwide Express, Worldwide Expedited, Standard, 3 Day Select, Next Day Air Saver, Next Day Air Early A.M., Worldwide Express Plus, 2nd Day Air A.M., Express NA1, Express Saver

 

Shipping Delay

1

 

 

Hi Gabor,

 

I just wondering what I installed is correct. I've downloaded from sourceforge the expat_win32bin v1.95.8 and installed under c:\php\Expat-1.95.8? My server is running on Windows 2003 Server Standard and PHP Version 4.3.9. After everything installed, I still get a blank page. I've place both Developer's key and Access Key for ups xml but still not working! Getting frustrated... Hope you could help! Thanks :'(

 

Regards,

Steve

Share this post


Link to post
Share on other sites

Steve,

 

Why don't you exchange the upsxml.php with the one of version 1.1.4 and enable logging (see the source code) and then also try to run cURL through exec (see the change.txt and the source code, almost at the bottom) if the logs point in that direction. Then you can at least see if cURL errors are the problem.

Share this post


Link to post
Share on other sites
... I still get a blank page. ...

 

Hi Steve!

 

Your CURL could work (try the short example I posted earlier).

Restart your server after installing the CURL.

If the example works, I thimg that you do not have installed the xml parser...

Enable the logging (see the contribution's readme).

 

Gabor

Share this post


Link to post
Share on other sites

Hi Steve!

I am a Linux developer, I do not know too much about M$ Win.

Sorry. :(

 

Gabor

Edited by gorcsos

Share this post


Link to post
Share on other sites

Hi Gador/Ianz,

 

I still facing the same blank page on checkout_shipping.php even after installing the php-xml parser (expat) from http://sourceforge.net/projects/expat/. I've installed the expat_win32bin v1.95.8 on c:\php\Expat-1.95.8. My current system is Windows 2003 Server with PHP Version 4.3.9.

 

I was wondering whether is my php.ini setting problem?? I've tried added some code after <body> tag recommended by Ianz, but nothing in return. You can have a look of my current server's php.ini setting on http://test.domainese.net/php/common/phpinfo.php.

 

Please help :(...

 

Regards,

Steve

Share this post


Link to post
Share on other sites

Hi Steve!

 

Q: Have you tried this curl example? Does it work?

<?php

$url = "http://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_FAILONERROR, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 3);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL");

$result = curl_exec($ch);

curl_close($ch);

echo $result;

?>

 

Q: Have you uncomented the:

// $this->logfile = '/tmp/upsxml.log';

in the '/home/yoursite/public_html/catalog/includes/modules/shipping/upsxml.log';???

 

Q: Do you have something like this in the upsxml.log?

UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit

UPS REQUEST: <?xml version="1.0"?>

<AccessRequest xml:lang="en-US">

<AccessLicenseNumber>**************</AccessLicenseNumber>

<UserId>**********</UserId>

<Password>***********</Password>

</AccessRequest>

<?xml version="1.0"?>

<TimeInTransitRequest xml:lang="en-US">

<Request>

...

 

UPS RESPONSE: <?xml version="1.0"?><TimeInTransitResponse><Response><TransactionReference><CustomerContext>Time in Transit</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><TransitResponse><PickupDate>2004-12-16</PickupDate><TransitFrom><AddressArtifactFormat><PoliticalDivision2>CALGARY</PoliticalDivision2><PoliticalDivision1>AB</PoliticalDivision1><

...

 

If yes, maybe you should try another parser, or install something like php-xmlrpc with your actual parser. I'm just guessing, I don't know too much about it ...

 

Gabor

Share this post


Link to post
Share on other sites

If you have the weight set to "0" shouldnt it be free shipping? I have this installed on my site and it works that way...

 

but I just installed the latest version on another site and I cannot get it to have free shipping for "0" weight...

Share this post


Link to post
Share on other sites

Hi Gabor/Ianz,

 

I've tried upload 1.1.4 and enabled logging. Here's what I got in my upsxml.log...

 

 

------------------------------------------
DATE AND TIME: 2004-12-22 11:03:18
UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit

 

 

... and as I run the test on the curl code below, I also got a BLANK PAGE.

 

<?php

$url = "http://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_FAILONERROR, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_TIMEOUT, 3);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, "url=index%3Dbooks&field-keywords=PHP+MYSQL");

$result = curl_exec($ch);

curl_close($ch);

echo $result;

?>

 

So what should I do next?

Share this post


Link to post
Share on other sites
... So what should I do next?

 

If you copied the example to a abc.php , then typed in the http://localhost/abc.php

and the result is a blank page then it looks for me like curl support problem.

Try to reinstall the curl, or install something like php-curl.

I had the curl installed but after I installed the php-curl ... it started to work.

 

Gabor

Share this post


Link to post
Share on other sites

Here's what I got from checkout_shipping after I've changed

 

$this->use_exec = '1';

 

under upsxml.php (following step 8 in readme.txt v1.1.4)

 

United Parcel Service (XML)??

 

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway : Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

If you prefer to use ups as your shipping method, please contact Neogeomancy via Email.

 

.... then in my upsxml.log it became:

 

------------------------------------------
DATE AND TIME: 2004-12-22 11:03:18
UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit
------------------------------------------
DATE AND TIME: 2004-12-22 11:16:16
UPS URL: https://wwwcie.ups.com:443/ups.app/xml/TimeInTransit
UPS REQUEST using exec(): <?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
? <AccessLicenseNumber>xxxxxxxxxxxxxxx</AccessLicenseNumber>
? <UserId>xxxxxxxxxxxx</UserId>
? <Password>xxxxxxxxx</Password>
</AccessRequest>
<?xml version="1.0"?>
<TimeInTransitRequest xml:lang="en-US">
? <Request>
? ? ? <TransactionReference>
? ? ? ? ? <CustomerContext>Time in Transit</CustomerContext>
? ? ? ? ? <XpciVersion>1.0001</XpciVersion>
? ? ? </TransactionReference>
? ? ? <RequestAction>TimeInTransit</RequestAction>
? </Request>
? <TransitFrom>
? ? ? <AddressArtifactFormat>
? ? ? ? ? <PoliticalDivision2>Seri Kembangan</PoliticalDivision2>
? ? ? ? ? <PoliticalDivision1>Selangor</PoliticalDivision1>
? ? ? ? ? <CountryCode>Malaysia</CountryCode>
? ? ? ? ? <PostcodePrimaryLow>43300</PostcodePrimaryLow>
? ? ? </AddressArtifactFormat>
? </TransitFrom>
? <TransitTo>
? ? ? <AddressArtifactFormat>
? ? ? ? ? <PoliticalDivision2>Seri Kembangan</PoliticalDivision2>
? ? ? ? ? <PoliticalDivision1>Selangor</PoliticalDivision1>
? ? ? ? ? <CountryCode>MY</CountryCode>
? ? ? ? ? <PostcodePrimaryLow>00000</PostcodePrimaryLow>
? ? ? ? ? <PostcodePrimaryHigh>00000</PostcodePrimaryHigh>
? ? ? </AddressArtifactFormat>
? </TransitTo>
? <PickupDate>20041225</PickupDate>
? <ShipmentWeight>
? ? ? <UnitOfMeasurement>
? ? ? ? ? <Code>KGS</Code>
? ? ? </UnitOfMeasurement>
? ? ? <Weight>10</Weight>
? </ShipmentWeight>
? <InvoiceLineTotal>
? ? ? <CurrencyCode>USD</CurrencyCode>
? ? ? <MonetaryValue>100</MonetaryValue>
? </InvoiceLineTotal>
</TimeInTransitRequest>

Error from cURL using exec() since there is no $xmlResponse
UPS RESPONSE using exec(): 
------------------------------------------
Time in Transit: 0
------------------------------------------
DATE AND TIME: 2004-12-22 11:16:16
UPS URL: https://wwwcie.ups.com:443/ups.app/xml/Rate
UPS REQUEST using exec(): <?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
? <AccessLicenseNumber>**********</AccessLicenseNumber>
? <UserId>*******</UserId>
? <Password>******</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
? <Request>
? ? ? <TransactionReference>
? ? ? ? ? <CustomerContext>Rating and Service</CustomerContext>
? ? ? ? ? <XpciVersion>1.0001</XpciVersion>
? ? ? </TransactionReference>
? ? ? <RequestAction>Rate</RequestAction>
? ? ? <RequestOption>shop</RequestOption>
? </Request>
? <PickupType>
? ? ? <Code>03</Code>
? </PickupType>
? <Shipment>
? ? ? <Shipper>
? ? ? ? ? <Address>
? ? ? ? ? ? ? <City>Seri Kembangan</City>
? ? ? ? ? ? ? <StateProvinceCode>Selangor</StateProvinceCode>
? ? ? ? ? ? ? <CountryCode>Malaysia</CountryCode>
? ? ? ? ? ? ? <PostalCode>43300</PostalCode>
? ? ? ? ? </Address>
? ? ? </Shipper>
? ? ? <ShipTo>
? ? ? ? ? <Address>
? ? ? ? ? ? ? <City>Seri Kembangan</City>
? ? ? ? ? ? ? <StateProvinceCode>Selangor</StateProvinceCode>
? ? ? ? ? ? ? <CountryCode>MY</CountryCode>
? ? ? ? ? ? ? <PostalCode>00000</PostalCode>
<ResidentialAddressIndicator/>
? ? ? ? ? </Address>
? ? ? </ShipTo>
? ? ? <Package>
? ? ? ? ? <PackagingType>
? ? ? ? ? ? ? <Code>02</Code>
? ? ? ? ? </PackagingType>
? ? ? ? ? <PackageWeight>
? ? ? ? ? ? ? <UnitOfMeasurement>
? ? ? ? ? ? ? ? ? <Code>KGS</Code>
? ? ? ? ? ? ? </UnitOfMeasurement>
? ? ? ? ? ? ? <Weight>26</Weight>
? ? ? ? ? </PackageWeight>
? ? ? </Package>
? </Shipment>
? <CustomerClassification>
? ? ? <Code>03</Code>
? </CustomerClassification>
</RatingServiceSelectionRequest>

Error from cURL using exec() since there is no $xmlResponse
UPS RESPONSE using exec():

 

hmm, might it be UPS server itself going wrong?

 

Regards,

Steve

Edited by The_Bear

Share this post


Link to post
Share on other sites

Shukei98, where are you from? US? Canada?

Have you already tried any contribution for FedEx?

Gabor

Share this post


Link to post
Share on other sites

Steve,

 

It definitely looks like cURL is not working on your server. In this page: http://www.eway.com.au/support/forum/displ...&PagePosition=1

I read that

With CURL on windows, I believe you need to install the CURL dll and its php extension dll (bundled with the win32 distro of php) into the system path (normally c:\winnt\system32), and uncomment the appropriate extension lines in your php.ini file.
On the php website ( http://www.php.net/curl there is information on curl and installing PHP on windows: http://www.php.net/manual/en/install.windows.php)

Share this post


Link to post
Share on other sites

I've enabled php_curl.dll and php_xmlrpc.dll under dynamic extensions in my php.ini and did an iisreset. But I still got the following error!!

 

United Parcel Service (XML)? 

Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway : Rating and Service 1.0001 0 An unknown error occured while attempting to contact the UPS gateway

If you prefer to use ups as your shipping method, please contact Neogeomancy via Email.?

 

To answer Gabor's questions, I am from Malaysia.

 

Here's my new configuration on the ups xml module, correct me if I'm wrong...

 

Enable UPS Shipping

True

 

UPS Rates Access Key

developer's key

 

UPS Rates Username

xxxxxxxxxxxx

 

UPS Rates Password

xxxxxxxxxx

 

Pickup Method

Customer Counter

 

Packaging Type

Customer Package

 

Customer Classification Code

03

 

Shipping Origin

All other origins

 

Origin City

Seri Kembangan

 

Origin State/Province

SL

 

Origin Country

MY

 

Origin Zip/Postal Code

43300

 

Test or Production Mode

Test

 

Unit Weight

KGS

 

Unit Length

CM

 

Quote Type

Residential

 

Handling Fee

0

 

Tax Class

--none--

 

Shipping Zone

--none--

 

Sort order of display.

0

 

Shipping Methods

Next Day Air, 2nd Day Air, Ground, Worldwide Express, Standard, 3 Day Select

 

Shipping Delay

1

 

 

This is the 2 regular error I got in upsxml.log::

 

Error from cURL using exec() since there is no $xmlResponse

UPS RESPONSE using exec():

Edited by shukei98

Share this post


Link to post
Share on other sites

Steve,

 

From the UPS log I already saw where you came from and even saw your username and password in the log.... Better ask a forum moderator (don't ask me how) to edit that.

 

In your phpinfo I miss the following entry like (this is from a Suse 9.0 Linux/Apache 2 test server):

 

openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.7b 10 Apr 2003

 

However, that would only mean that you cannot setup https connections. The example given by Gabor for http to Amazon should still work. It would be best to use $this->use_exec = '0'; That way you can log any cURL errors, not with use_exec=1. But if '0' doesn't work....

Share this post


Link to post
Share on other sites

Steve,

 

From your phpinfo.php page I can see that your php.ini file is: c:\php\php.ini. You also have set "display_errors: Off" which is a good thing for a production server (you don't want the hackers to learn something about your server) but if PHP is throwing errors you will only get a blank page which tells you nothing... You have enabled error logging in php.ini, however you haven't given a location and a file name for the error log, so you can't check that either.

Share this post


Link to post
Share on other sites

Forgive me if this question's already been asked.

 

I'm trying to update the names in english/modules/upsxml.php. But when I change "UPS 3 Day Select" to "3 Day Shipping", it no longer comes up in searches.

 

Is there any way to do this?

 

Thanks,

Sam

Share this post


Link to post
Share on other sites

I got the following errors after changing error_log to a file name in php.ini and did a iisreset.

 

[22-Dec-2004 22:33:52] PHP Warning:  exec(): Unable to fork [which curl] in C:\Domains\NeoGeomancy.com\wwwroot\catalog\includes\modules\shipping\upsxml.php on line 610

[22-Dec-2004 22:33:52] PHP Warning:  exec(): Unable to fork [curl -d "<?xml version=\"1.0\"?>

 

I am pretty sure is the cmd.exe problem of not giving premission to IUSR_XXXX that caused exec() to fail, so I've given the whole windows/system32 dir (where cmd.exe resides, following some recommendation in internet) read/read exec permission but still failed.

 

In my upsxml.log still show the same thing

 

Error from cURL using exec() since there is no $xmlResponse

UPS RESPONSE using exec():

 

Now I really ran out of ideas!! Exhausted.....!

Share this post


Link to post
Share on other sites

I can't get UPS Next Day Air Saver to come up under any circumstances. All other services come up fine. Anyone else having this problem?

Share this post


Link to post
Share on other sites

Actually, Next Day Air Saver disappeared because I changed it to "Next Day Air 3:00". Oish, isn't there anyway to rename these things to something normal human beings understand?

Share this post


Link to post
Share on other sites
isn't there anyway to rename these things
I think this should work, look for those lines around line 233 in includes/modules/shipping/upsxml.php:

 ? ? ? ? ? ? ? ?// BOF limit choices
? ? ? ? ? ? ? ?if (!exclude_choices($type)) continue;
? ? ? ? ? ? ? ?// EOF limit choices
?if ($type == "UPS Next Day Air Saver") {
?	$type = "Next Day Air 3:00";
?}
? ? ? ? ? ? ? ?if ( $method == '' || $method == $type ) {

Edited by JanZ

Share this post


Link to post
Share on other sites
The information wasn't helpful coz I am running on windows 2003 + IIS 6 (not apache). Any suggestion?
I found a few things on the internet using that error phrase, but not any "thank you that worked" replies...
I) Give to C:\windows\system32\cmd.exe read & execute permissions to

IUSR_... user

Ii) Include the following line in your php.ini: safe_mode_exec_dir =

c:\ImageMagick (or wherever you have installed it).

 

http://www.zirkon.at/yappa-ng_demo/docs/INSTALL.html#fork

 

If you get an error like:

 

???Warning: exec(): Unable to fork [C:\ImageMagick\convert.exe -size 50x50.....

 

This is a windows-related issue and has nothing to do with yappa-ng but with the permission settings on your webserver!

 

There may be an easy way out for you (thanks to Jesper Rudbeck, who sent me this hint):

"We had lotso fun with "unable to fork" errors. It turned out to be a permissions problem. You must give RX permission on "\winnt\system32\cmd.exe" to the user account that your web server runs as (e.g. IUSR_xxx on IIS, LocalSystem on Apache).

Turning on a Win2000 user right called "Bypass traverse checking" also solved a related problem but I forget what or why."

 

Another solution has been submitted by swbadn (Thanks):

"I copied cmd.exe into the c:\php folder and that seems to work as well. I set the permissions to read and execute only. This keeps from having to give anonymous access to C:\winnt\system32\cmd.exe where all of those nasty IIS scripts always seem to attack and I think is a little more secure than having to give access to the cmd.exe in the C:\winnt\system32 directory."

I'm not 100% sure that you can only use cURL through exec. I read at least one note that said otherwise, I think it was in the link to the article I posted earlier. I also read in the Authorize.net thread (topic 54971) that the "which curl" statement was not working on Windows. Perhaps the curl path should be added to the upsxml.file too (can't hurt of course...).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×