ajreaper Posted August 31, 2008 Share Posted August 31, 2008 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. They did tell me, however, that the script doesn't need a complete rewrite but modifications have to be done to the cURL coding. So far I have come to the point where I hate GoDaddy to the point where I want to vomit blood. Yes, 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. 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 @curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP) @curl_setopt($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128") to @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: 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 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 (not not NULL) -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 needed. Link to comment https://forums.phpfreaks.com/topic/122151-curl-proxy-connection-for-a-shop-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.