Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cURL Proxy Connection (GoDaddy & Shop Script PRO)
31-08-2008, 07:27 AM
Post: #1
cURL Proxy Connection (GoDaddy & Shop Script PRO)
For about four hours I was racking my brain on this stupid problem and for whatever reason I cannot fix it. I have been repeating the SAME THING over and over again with the same results.

I have Shop Script PRO. The Author won't help me because I purchased the script from a second party (might have been a reseller but I don't know, but I did pay for it). I did ask the Author for a module or instructions on how to modify the usps shipping module on my own, but they wanted an ORDER ID, which I don't have. So... I am trying to figure it out on my own. So far I have come to the point where I hate GoDaddy to the point where I want to vomit blood.

The host we have is GODADDY (shared, linux). The server has cURL installed but it requires a proxy server. I modified the cURL code, but I am still unable to get real-time USPS shipping quotes.

Here is the color syntax of the entire module: http://cosmicgivers.com/codesyntax.html

My Errors:

cURL - Initially I was getting error 7, then error 28 and error 56. The errors stopped showing after I made an alteration to the API url, as suggested by a few sites.

USPS - The errors I receive are either 1001 (which may be just access points?), API Authorization failure. RateV2 is not a valid API name for this protocol. (with http://production.shippingapis.com) and Authorization failure. You are not authorized to connect to this server. (with https://secure.shippingapis.com ). I have an email stating that our account is live so that isn't an issue.


I also considered just installing it in my root on the GoDaddy account (since I cannot access any subfolders). I am not sure if that would work and, further more, I have absolutely no idea how I would do that. The site using this script is: https://cosmicgivers.com/shop/ What is SUPPOSED to appear is, on the first step of checkout, there SHOULD be a drop down box with the shipping quotes. Unfortunately it hasn't yet done that.


Code:
function _sendXMLQuery($_XMLQuery){

    if(!$_XMLQuery)return '';
    if ( !($ch = curl_init()) ){
    
    $this->_writeLogMessage(MODULE_LOG_CURL, 'Local error: '.ERR_CURLINIT)
    return ERR_CURLINIT;
    }

    if ( curl_errno($ch) != 0 ){
    
    $this->_writeLogMessage(MODULE_LOG_CURL, 'Curl error: '.curl_errno($ch))
    return ERR_CURLINIT;
    }

    if(strpos($_XMLQuery, 'RateV2Request')===false)
    $_Type = 'International';
    else
    $_Type = 'Domestic';
    
    switch ($_Type){
    case 'Domestic':
    $url = 'http://production.shippingapis.com/shippingapi.dll?API=RateV2&XML='.urlencode($_XMLQuery)
    break;
    case 'International':
    $url = 'https://secure.shippingapis.com/shippingapi.dll?API=IntlRate&XML='.urlencode($_XMLQuery)
    break;
    }

    @curl_setopt( $ch, CURLOPT_URL, $url )
    @curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 )
    @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 )
    @curl_setopt($ch, CURLOPT_TIMEOUT, 120 )
    @curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP)
        @curl_setopt($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128")

    $result = @curl_exec($ch)
    if ( curl_errno($ch) != 0){
    
    $this->_writeLogMessage(MODULE_LOG_CURL, 'Curl error: '.curl_errno($ch))
    return ERR_CURLEXEC;
    }

    curl_close($ch)
    
    return $result;
    }





Oh, and also... what I tried:

cURL:

I added

Code:
@curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP)
@curl_setopt($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128")

to

Code:
@curl_setopt( $ch, CURLOPT_URL, $url )
@curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 )
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 )
@curl_setopt( $ch, CURLOPT_TIMEOUT, 10 )

And then changed the timeout to 120 to get rid of one of the cURL errors.

After that change I was getting errors in my usps log. So I changed:

Code:
switch ($_Type){
case 'Domestic':
$url = 'https://secure.shippingapis.com/shippingapi.dll?API=RateV2&XML='.urlencode($_XMLQuery)
break;
case 'International':
$url = 'https://secure.shippingapis.com/shippingapi.dll?API=IntlRate&XML='.urlencode($_XMLQuery)
break;
}

to

Code:
switch ($_Type){
case 'Domestic':
$url = 'http://production.shippingapis.com/shippingapi.dll?API=RateV2&XML='.urlencode($_XMLQuery)
break;
case 'International':
$url = 'https://secure.shippingapis.com/shippingapi.dll?API=IntlRate&XML='.urlencode($_XMLQuery)
break;
}


My last cURL error was at 3 in the morning and it was Curl error: 28. It hasn't shown any new errors since modifying the urls as seen above.

With the above changes I receive USPS error:
Authorization failure. You are not authorized to connect to this server.

With BOTH urls changed to http://production.shippingapis.com/shippingapi.dll I receive this error:
[DATE] [TIMECODE]
1001


After the changes are made to cURL, the default settings for the url result in:
API Authorization failure. RateV2 is not a valid API name for this protocol.

But before that it is:
[DATE] [TIMECODE]
1001



I have also:
-Removed the @s in front of the curl tags,
-Changed the proxy server to http://64.202.165.130:3128
-Switched around 1 and 0 for FALSE and TRUE
-Used port 443 instead
-Changed anything saying HTTP to HTTPS (with the above)
-Screamed, yelled, and swore in hopes I might scare the script into working...

I can also upload the error logs if you want.

Life is like a box of jelly bellies--without a menu you aren't sure what it is you are sticking in your mouth.
Send this user an email Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: