Post by CodeBits » Tue Jun 16, 2009 4:13 am

I don't think this is a problem with OpenCart, but all three of the sites I have running are returning this error from admin/home link

Code: Select all

Warning: file_get_contents(http://currencysource.com/RSS/USD.xml) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Access Forbidden/Abuse in /home/www/opencart.nwisg.net/admin/model/localisation/currency.php on line 76

Warning: array_combine() [function.array-combine]: Both parameters should have at least 1 element in /home/www/opencart.nwisg.net/admin/model/localisation/currency.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /home/www/opencart.nwisg.net/admin/model/localisation/currency.php:76) in /home/www/opencart.nwisg.net/system/library/response.php on line 65
Line 76 link to http://currencysource.com/RSS/ is returning;
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.

Now I shut off auto currency update and still have the error when clicking on the Home link from the breadcrum or dropdown menu.

Any Ideas?

Appears others are having similar problems http://forum.opencart.com/viewtopic.php?f=20&t=4424

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by Daniel » Tue Jun 16, 2009 4:40 am

ask your host to allow fopen for external sites.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by CodeBits » Tue Jun 16, 2009 5:30 am

Daniel these sites have been running for sometime now, in fact two of them I have been working on all day until just before this post of errors and nothing was wrong. I'm going to check with my server admin now to see if they shut down fopen for external sites, but I can't imagine why unless there is an abuse problem.

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by CodeBits » Tue Jun 16, 2009 6:32 am

Response from my server admin:
Hello,

Thank you for contacting our Technical Support Department.

No changes have been made on the server setup. The possible reasons for that problems could be recent update of the site script, change of the account settings (php version, php settings at php.ini) or a hacker attack that as modified some parts of the site. Please verify if everything with the files and the setup is correct.

If there is anything on our end that we could be of help with, just let us know.

I guess I'll check for script problems but...
Neither of these sites had any changes made to them from the point they were working correctly

??? ???

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by Daniel » Tue Jun 16, 2009 6:34 am

ok,

the next version is using a different url. I think i can releqse it this week.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by CodeBits » Tue Jun 16, 2009 9:22 am

Rather than try and search this out I did a complete new install on my demo site... Really wired, same errors.

The url the script tries to return http://currencysource.com/RSS/USD.xml works. ???

Well I hope the new version solves the problem. This is just to strange as these sites have been running just fine for weeks.

Thanks for your attention to this problem.

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by Daniel » Tue Jun 16, 2009 9:28 am

I think they blocked php from parsing the information.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by CodeBits » Tue Jun 16, 2009 10:06 am

Didn't think about that... bummer!
Lots of sites are gona be broken now.

Well we in you capable hands now Daniel... ;)

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by andychoi » Wed Jun 17, 2009 9:55 pm

Open curency.php
comment line 73 to 91.,
basically, disable the ADAVNACE auto update exchange rate fucntion.
check the code and pay attention to the position of /* */


public function updateCurrencies() {
/*
$query = $this->db->query("SELECT * FROM currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified > '" . date(strtotime('-1 day')) . "'");

if ($query->num_rows) {
$xml = file_get_contents('http://currencysource.com/RSS/' . $this->config->get('config_currency') . '.xml');

preg_match_all('/([A-Z]{3}) \((.*)\)/', $xml, $match);

$rate = array_combine($match[1], $match[2]);

foreach ($query->rows as $result) {
if (isset($rate[$result['code']])) {
$this->db->query("UPDATE currency SET value = '" . (float)$rate[$result['code']] . "', date_modified = NOW() WHERE currency_id = '" . (int)$result['currency_id'] . "'");
}
}
}

$this->cache->delete('currency');
*/
}

Newbie

Posts

Joined
Sun Jun 14, 2009 10:32 am

Post by CodeBits » Wed Jun 17, 2009 11:43 pm

Piece of cake... Thanks for the tip!

In this thread http://forum.opencart.com/viewtopic.php?f=20&t=4424 explains a problem with empty dollar values being sent.
And my Cart will add up but where it says total in the Checkout says 0.00 and when it transfers to paypal Site still says 0.00 you have to add the cost which it should already of added up, any idea why please.
I haven't experienced this as I'm just starting to build a store and don't have pay systems in place yet, but Will this resolve his or her problem?

User avatar
Active Member

Posts

Joined
Fri Jun 05, 2009 3:16 am

Post by kdmp » Tue Jun 30, 2009 10:16 am

Hey Dan,

Another post about this issue, eh? :P

The error message I am receiving by PHP provides this: failed to open stream:
HTTP request failed! HTTP/1.1 403 Access Forbidden/Abuse.
I would assume that opencart is being blocked. Now, why is opencart checking it each time the admin page is loaded? Would it not be better to create a entry in the database so that it can be logged that it was checked on the day? Or even limit it to checking it via a cronjob a certain amount of times a day?

My two cents...maybe a penny...maybe nothing..but hey.

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by kdmp » Tue Jun 30, 2009 11:14 am

Okay,

They are definitely blocking our servers from accessing their xml. i decided to put my cURL idea to the test.

I changed:

Code: Select all

$xml = file_get_contents('http://currencysource.com/RSS/' . $this->config->get('config_currency') . '.xml');
and replaced it with:

Code: Select all

$data = curl_init('http://currencysource.com/RSS/' . $this->config->get('config_currency') . '.xml');
curl_setopt($data, CURLOPT_RETURNTRANSFER, true);
curl_setopt($data, CURLOPT_HEADER, 0);
$xml = curl_exec($data);
curl_close($data);
print $xml;
The out put from $xml is:
403 Access Forbidden/Abuse
Warning: array_combine() [function.array-combine]: Both parameters should have at least 1 element in /home/user/public_html/admin/model/localisation/currency.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/admin/model/localisation/currency.php:85) in /home/user/public_html/system/library/response.php on line 65
The expected result is not there, instead we are receiving a 403 Access error which then can not be broken down by the parser.

So I then added a useragent to the mix:

Code: Select all

$data = curl_init('http://currencysource.com/RSS/' . $this->config->get('config_currency') . '.xml');
			
// PRETEND TO BE FIREFOX
$useragent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
		
// CURL ADDITION - KEVIN DAVIDSON
curl_setopt($data, CURLOPT_USERAGENT, $useragent);
curl_setopt($data, CURLOPT_RETURNTRANSFER, true);
curl_setopt($data, CURLOPT_HEADER, 0);
$xml = curl_exec($data);
curl_close($data);
		
print $xml;
Voila, I can now see the xml data (edit - but it must have been more than 15 minutes since the last check - see below). Now my xml is shady, so I am not sure what the problem is with preg_match, because if you comment the print statement the last two original errors pop up.
Warning: array_combine() [function.array-combine]: Both parameters should have at least 1 element in /home/sinfulde/public_html/admin/model/localisation/currency.php on line 96

Warning: Cannot modify header information - headers already sent by (output started at /home/sinfulde/public_html/admin/model/localisation/currency.php:96) in /home/sinfulde/public_html/system/library/response.php on line 65
Now, I do have to agree with this post:

http://forum.opencart.com/viewtopic.php ... =15#p21469

They are preventing the page from being accessed too many times, see terms:
You may repeatedly pull this data during the hours specified above, but may not exceed once every 15 minutes (per individual currency). For example, you may download the GBP and AUD currencies every 15 minutes without problem, but you may not download the GBP currency itself every 2 minutes. If your computer/RSS reader is found to be pulling the data more frequently than 4 times per hour, we reserve the right to restrict your access to this information. CurrencySource.com reserves the right to move the feeds to alternate and/or multiple servers based on usage patterns (so the feed address may occasionally change). These terms of service are subject to change.
The solution is a cron job that runs every 15+ minutes.

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by saima122 » Fri Nov 26, 2010 2:42 pm

thanks...

Currency Rates in Pakistan


Newbie

Posts

Joined
Fri Nov 26, 2010 2:26 pm
Who is online

Users browsing this forum: No registered users and 154 guests