cURL - anybody know about it?


#1

My host does not allow remote connections so I am unable to update my currencies in OSCommerce. They now use cURL. http://wiki.dreamhost.com/index.php/CURL

I need to change my localization.php file but I know nothing about php. Is there anybody who could change the coding of this file for me if I send the original?

Thanks so much!
Mary


#2

Can you give us a little better idea of just what needs to be done? I have done a fair amount of curl coding for projects I’ve been involved with, but I am unclear on what exactly you’re asking about.


#3

Thank you for responding. I have just changed hosts and have uploaded OSCommerce. I need to be able to update currencies in my localization.php file because now when I click to update, I get a page of warnings such as:

[color=#0000CC]Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 14

Warning: file(http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=USD&format=CSV&dest=Get+Table&sel_list=USD) [function.file]: failed to open stream: no suitable wrapper could be found in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 14

Warning: implode() [function.implode]: Bad arguments. in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 18

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 28

Warning: file(http://www.xe.net/ucc/convert.cgi?Amount=1&From=USD&To=USD) [function.file]: failed to open stream: no suitable wrapper could be found in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 28

Warning: implode() [function.implode]: Bad arguments. in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 32

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/.yessirree/ma3ry/christiangays.com/store/admin/includes/functions/localization.php on line 14[/color]

From what I understand, for security reasons this host does not allow me to connect to an outside server, so the workaround is cURL, which I have no idea about.

I wanted to attach the file in question but don’t know how to attach on this forum. What I need is for someone to code it so that I will be able to access an outside website to update my currencies.

Hope that explains. I really know absolutely nothing about this and am totally lost.

Thanks again for responding.

Mary


#4

I did a quick Google search and saw that you have also posted a request with much detail on the oscommerce forums. I am not at all confident that I’ll be able to help you fix the issue, but I am willing to poke around for a little bit. Hope to post back again before too long.


#5

Bless your heart! Thank you! Yes, I have been asking for help all over, without much luck I’m afraid.

Many thanks for your interest!
Mary


#6

This is good time for change to one-click Zen Cart?


#7

The problem is not with OSCommerce but with my host and their rigid security, for which I’m grateful.

Thanks anyway.

Mary


#8

Please post the relevant section of localization.php and I’ll take a look at it.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#9

Many thanks!

function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
$page = file(‘http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=’ . $code . ‘&format=CSV&dest=Get+Table&sel_list=’ . $base);

$match = array();

preg_match(’/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i’, implode(’’, $page), $match);

if (sizeof($match) > 0) {
return $match[3];
} else {
return false;
}
}

function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
$page = file(‘http://www.xe.net/ucc/convert.cgi?Amount=1&From=’ . $from . ‘&To=’ . $to);

$match = array();

preg_match(’/[0-9.]+\s*’ . $from . ‘\s*=\s*([0-9.]+)\s*’ . $to . ‘/’, implode(’’, $page), $match);

if (sizeof($match) > 0) {
return $match[1];
} else {
return false;
}
}
?>


#10

I have no way of testing this, but you could try the following code (make a backup of your original file first):[code]function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
$url = “http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=$code&format=CSV&dest=Get+Table&sel_list=$base”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
$page = curl_exec($ch);
curl_close($ch);
$match = array();
preg_match(’/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i’, implode(’’, $page), $match);
if (sizeof($match) > 0) {
return $match[3];
} else {
return false;
}
}

function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
$url = “http://www.xe.net/ucc/convert.cgi?Amount=1&From=$from&To=$to”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
$page = curl_exec($ch);
curl_close($ch);
$match = array();
preg_match(’/[0-9.]+\s*’ . $from . ‘\s*=\s*([0-9.]+)\s*’ . $to . ‘/’, implode(’’, $page), $match);
if (sizeof($match) > 0) {
return $match[1];
} else {
return false;
}
}[/code]-- si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#11

Thank you so much. Your code now takes me outside of my host (hurray!) to the Oanda.com website, however what I need it to do is to update all the store prices automatically. My son-in-law says it needs a cron job so perhaps this is now out of your realm of expertise and needs someone familiar with OSCommerce.

Thank you again so much! You fixed a major hurdle for me. It still needs more work but you helped immensely in this first part and I so appreciate it!!!

Thanks again!
Mary