0

for currency conversion i have used a link and used in code $url="http://www.google.com/finance/converter?a=$amount&from=$currFrom&to=$currInto";

function getHtmlCodeViaFopen($url)

{
       $ci =& get_instance();
    $returnStr="";

    $default_currency_code=$ci->config->item('default_currency_code');

    if($default_currency_code!="USD")
    {
        $fp=fopen($url, "r") or die("ERROR: Failed to open $url for reading via this script.");
        while (!feof($fp)) {
            $returnStr.=fgetc($fp);
        }
        fclose($fp);
        return $returnStr;
    }

now the url not responding in my server but works fine in my url i used preg match to retrieve the characters from that url

It shows the die error ERROR: Failed to open http://www.google.com/finance/converter?a=40&from=USD&to=USD for reading via this script. Thanks in advance.

4

1 回答 1

2

this happens even with this?

$data = file_get_contents("http://www.google.com/finance/converter?a=1&from=EUR&to=USD");

print $data to see if data has been received.

EDITED:

Ok, call this also. What did you get?

echo ini_get("allow_url_fopen");
于 2012-06-07T01:10:13.823 回答