bulmer Posted December 3, 2010 Share Posted December 3, 2010 Hello everyone. First post and am very much a learner.. I have been modifying a Shipping Module, for my Zen-cart website, on a Local Development setup on my PC. I have it working perfectly on my local setup but once I upload it to my website it won't work! (Pride deflating..) The PHP versions, on both setups are the same. I'm really stuck with this one and would really appreciate anyones help. The problem may be with urlencode, but I'm not sure where.I only have to insert the 'postcode' and 'city' variables into the URL parameters, the rest are just hardcoded. I had to urlencode the 'city' variable before insertion, due to the spaces between many town names. They insist on a space being made after the city ($foo) argument also, which is why i included '%20'. // First get the destination postcode and city name $topcode = $order->delivery['postcode']; $zoo = $order->delivery['city']; $foo = urlencode($zoo); if ( $topcode == '' ){ // Something is wrong, we didn't find any dest zip $this->quotes['error'] = MODULE_SHIPPING_XXX_NO_POSTCODE_FOUND; return $this->quotes; } //SENDS A REQUEST TO THE API FOR THE XML FILE $url = "http://www.xxxxxxx.org/Magic94Scripts/mgrqispi94.dll?appname=FW&PRGNAME=FastLocatorRecord&ARGUMENTS=-A1,-ANTH,-A$foo%20,-A$topcode,-A10,-N1"; $xml = file_get_contents($url) ; //TRANSFORMS THE RETURNED XML INTO AN OBJECT $rec = simplexml_load_string($xml); Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/ Share on other sites More sharing options...
BlueSkyIS Posted December 3, 2010 Share Posted December 3, 2010 can you expand on "it won't work"? what won't work? any errors? what is supposed to happen that isn't. Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142773 Share on other sites More sharing options...
bulmer Posted December 4, 2010 Author Share Posted December 4, 2010 My log shows this error: "file_get_contents(http://www.xxxxxxx.org/Magic94Scripts/mgrqispi94.dll?appname=FW&PRGNAME=FastLocatorRecord&ARGUMENTS=-A1,-ANTH,-AHogarth+Range%20,-A2469,-A10,-N1) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: no suitable wrapper could be found in /home/zzzz/public_html/includes/modules/shipping/xxxxxxx.php on line 80" line 80 is : $xml = file_get_contents($url) ; The $url variables contents have been urlencoded before the request was sent? How can I avoid this happening? Is it a setting in my websites PHP config? Cheers. Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142787 Share on other sites More sharing options...
Pikachu2000 Posted December 4, 2010 Share Posted December 4, 2010 Is there another error message in the same vicinity that looks like this, per chance? Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /Applications/MAMP/htdocs/test.php on line 2 Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142791 Share on other sites More sharing options...
bulmer Posted December 4, 2010 Author Share Posted December 4, 2010 Yes, there is. Does that mean that I need to change the Files' Permissions settings? Or is it a setting somewhere else? Cheers. Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142803 Share on other sites More sharing options...
bulmer Posted December 4, 2010 Author Share Posted December 4, 2010 Ok, i've sorted it out now. I had to recode to use Curl instead because fopen is disabled on my sites Server, for security reasons. Here's the link on how to do it for anyone else that may trip-up: http://www.php.net/manual/en/curl.examples-basic.php Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142816 Share on other sites More sharing options...
sweeb Posted December 4, 2010 Share Posted December 4, 2010 for what it's worth, you really shouldn't be using file_get_contents over cURL even if it was enabled on your server. cURL is 10x more efficient, and has tons more options. Link to comment https://forums.phpfreaks.com/topic/220611-file_get_contents-help-needed/#findComment-1142848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.