Jump to content

Need Help on UPS Shipping Integration (Using cURL)


ansari81

Recommended Posts

Hi,

I have using the XML web services to integrate with UPs shipping I have using the following code and the error as output as follows,

[b][i]if(!is_callable("curl_exec")) die("USPS::submit_request: curl_exec is uncallable");
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,$post_url); //$post_url is a URL where we have post the data
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_request"); //Post the data as XML format
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$xml_result = curl_exec ($ch);
curl_close ($ch);
var_dump($xml_result);[/i][/b]

While I execute the above code i get the error saying that

[i][b]bool(false)[/b][/i]

I have got some befor from other resources they are said that "[i]Please check your error log for cURL specific errors.  It sounds like your server isn't connecting to the UPS web service at all.  There should be an error message unless verbose errors are disabled in your php.ini file.[/i]"

By the above advice i make php.ini file with the following line

[i]log_errors = On
error_log = error_log[/i]

I din't found any size variation on php.ini i.e. No error has been stored in php.ini. Sombody please help me I'm in very urgent to do this process
Link to comment
Share on other sites

Not sure exactly what you are looking to do...but I would imagine that you want to grab tracking information or something like that. As I have mentioned in this forum before, I have written a PHP class called ripCURL that makes data retrieval really easy. You need curl (obviously) and at least PHP5. The class is located at: http://ripcurl.sdsustudent.com/ which has the most up to date release. It is also at: http://sourceforge.net/projects/ripcurl
There is included documentation (in .doc format...I know, I'm sorry) that should guide you into using the class.

For instance, if you are trying to automatically get to the tracking page then pull some data...might look something like this:

[code]<?php
require_once('ripcurl.class.php');

$rip = new ripcurl();

//Get first page
$rip->ripRun('http://ups.com/content/us/en/index.jsx', 1);

//Gather and change form data
$data = $rip->getFormElements('trackMod');
$data['AgreeToTermsAndConditions'] = 'yes';
$data['tracknum'] = 'your tracking number here';
$form = $rip->getFormInfo('trackMod');

//Post data to display tracking info page
$rip->ripRun($form['action'], 1, $data);
echo $rip->getRawHtml();
?>[/code]

Something like this should work....
Link to comment
Share on other sites

Thanks for your help. My problem is not with the cURL, when i write the cURL error, I have got the following error as
[i][b]
SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed[/b][/i]

Please help me how could over come this problem.

Thanks in advance
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.