Jump to content

file_get_contents - help needed


bulmer

Recommended Posts

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
Share on other sites

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
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.