Hi All,
For those who are not aware AusPost are killing the old drc.edeliver.com.au/ratecalc.asp rate calculator and have introduced a new API.
No one at Auspost can tell me when this new API will be the only avenue to obtain Auspost shipping quotes.
I have been using the free auspost contribution for a few years. It works well.
Recently Auspost made a DNS change and the old api stopped reporting delivery times. By point directly at the old IP address this as a workaround has worked well. IP = 155.144.24.22
The new API from Auspost is a bit more complex and requires a personal ID Key to be embeded in the URL Via CURL. After working this out it does seem to work with a few glitches.
No shipping days are returned, and the US $9 tax on items over .5kg is not being calculated.
Documentation available here: http://auspost.com.au/devcentre/asse...3-20110929.pdf
Finally to my question:
Has anyone integrated the new auspost API into the free auspost shipping module.
While it is not rocket science i would hate to re-invent the wheel.
To use the api you must register and get a personal id.
Then Simple PHP to access the site is:
<?php
function get_auspost_api($url)
{
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_HTTPHEADER, array('AUTH-KEY:<PUT YOUR KEY HERE>'));
curl_setopt ($crl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
//International Air parcel postage calculation example)
$auspost_xml = get_auspost_api(
"https://auspost.com.au/api/postage/parcel/international/calculate.xml?&country_code=US&weight=.49&service_code=INTL_SERVICE_AIR_MAIL&ext ra_cover=");
//Do XML stuff
$xml = simplexml_load_string($auspost_xml);
echo $xml->getName() . "<br />";
foreach($xml->children() as $child)
{
echo $child->getName() . ": " . $child . "<br />";
}
echo $xml->service . "\n";
?>
Bookmarks