This is my first crack at UPS tracking and I am getting absolutely nothing. I see 200 in the network tab, but that is from my server, serving up the page.
Do you see anything wrong with the following code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// UPS SHIP ORDER TRACKING
$xmlRequest1='<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>my access key</AccessLicenseNumber>
<UserId>my user id</UserId>
<Password>my password</Password>
</AccessRequest>
<?xml version="1.0"?>
<TrackRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Your Test Case Summary
Description</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Track</RequestAction>
<RequestOption>activity</RequestOption>
</Request>
<TrackingNumber>1Z12345E0205271688</TrackingNumber>
</TrackRequest>';
try
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://wwwcie.ups.com/ups.app/xml/Track");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
echo $xmlResponse = curl_exec ($ch); // TRACKING RESPONSE
}
catch(Exception $ex)
{
print_r("Exception: " . $ex);
}
Whether I serve it in http or if go command line php post_track_ups_2.php, there is nothing being printed or echoing. Shouldn't I see something?
There is a 404 for the favicon, but that's nothing. This should work! Shouldn't there be an exception thrown at least? Something!
The tracking number is from UPS documentation page 7 "Tracking Web Service Developer Guide"
Thanks in advance
As with all the comments, you can see that the issue had to do with not using the latest openssl, which has tsl 1.2 that UPS and others look for to have secure cURL post & respond.
Just in case anyone else goes through this, here are the steps that I took to make my mac os 10.10 working in compliance.
First, I downloaded the latest openssl from openssl.org and installed - you can google for better instructions than I could give, but basically make sure your brew is up to date and use it to install.
That will get the latest openssl on CLI (command line interface), but it will not work with apache/php web browser. I discovered this by making a phpInfo() page and, to my shock, it still read 0.9.8zf
After a lot of reading, this is what I did:
cd into the openssl directory that you expanded after download
Your paths maybe different than mine, so adjust accordingly:
cd /Users/<home directory>/Downloads/openssl-1.0.2q
./Configure darwin64-x86_64-cc -fPIC shared --prefix=/PREFIX/openssl --openssldir=/PREFIX/openssl
make
make test
make install
brew install php --with-apache --with-homebrew-curl --with-homebrew-libxslt --with-homebrew-openssl --without-snmp
set path - /usr/local/Cellar/php56/5.6.9/bin/php in httpd-ssl.conf
also export /usr/local/Cellar/php56/5.6.9/bin/php in ~/.bash_profile
source ~/.bash_profile
insert the following line into httpd.conf
LoadModule php5_module /usr/local/Cellar/php56/5.6.9/libexec/apache2/libphp5.so
sudo apachectl restart
Thanks to all who commented. One thing lead to another to get to this point and I thank you all.