Im trying to write a Script to automate printing of UPS shipping labels from my shopping cart (zen-cart). I am using Curl to Post the information to UPS shipping page. Problem is, in order to post, i need to have the UPS session cookies: session_ups_com and com.ups.com_ups_uis.sData I can retrieve them manually by using "Live HTTP Headers" software. But I cant figure out a way to get them in the script. If i copy and paste these cookies in the script - it works well. <?php //this part does the posting $url = "https://www.ups.com/uis/create?loc=en_US&WT.svl=PNRO_L1"; $post = "Country=&Company=&.."; //this string needs to be created. for the sake of this test, i used "Live HTTP Headers" plugin for Firefox to track a post string (i did not include it here for security reasons). $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //if i login to ups.com and paste the session cookies into this line, the script works. but it kind of makes it pointless. does anyone know a way to extract these cookies in some way? curl_setopt($ch, CURLOPT_COOKIE, "{current session cookies"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $result = curl_exec($ch); curl_close($ch); header("Location: https://www.ups.com/uis/create?ActionOriginPair=RESUME___CreateAShipment&loc=en_US"); ?> PHP:
yes, i applied on the UPS website to get access to their API, but have not heard back from them. I read somewhere on ups.com that they only give access to accounts who ship over 50 packages per day (or week). Any ideas?
I guess i have to figure out a way to login to UPS with CURL. Something like this for Amazon: http://www.weberdev.com/get_example-4136.html but it just doesnt seem to work for UPS.