Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

GoogleMapsAPI really really really slow
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
chieduo
Smarty n00b


Joined: 28 Jul 2010
Posts: 2

PostPosted: Wed Jul 28, 2010 1:28 pm    Post subject: Commentted DB Connection Reply with quote

I took out instances of db connections in putCache and getCache the new google map api allows for 1000 or so requests from one ip address a day. So each visitor can do 1000 requests therefore I don't see the need for a second or two second delay for caching requests. I guess it all depends on how many requests you do per day.
Back to top
View user's profile Send private message
chieduo
Smarty n00b


Joined: 28 Jul 2010
Posts: 2

PostPosted: Wed Jul 28, 2010 1:52 pm    Post subject: Final step to making your script faster Reply with quote

change fetchURL to

function fetchURL($url) {

//return file_get_contents($url);
return $this->curl_get_file_contents($url);

}

and add curl_get_file_contents

function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);

if ($contents) return $contents;
else return FALSE;
}

I know this is old but if this problem is still bothering you like it did with me this solution was a life saver
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP