|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
spaceapple Smarty n00b
Joined: 27 Jan 2007 Posts: 2
|
Posted: Sat Jan 27, 2007 7:32 am Post subject: using GoogleMapAPI without file_open_contents |
|
|
Is there a way to use the api without file_get_contents? This is disabled on my server. I tried using cURL with no luck. Is there a simple workaround? |
|
Back to top |
|
spaceapple Smarty n00b
Joined: 27 Jan 2007 Posts: 2
|
Posted: Sat Jan 27, 2007 7:32 am Post subject: |
|
|
Here is the function I tried to replace:
function fetchURL($url) {
return file_get_contents($url);
}
replaced with
function fetchURL($url){
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// grab URL and pass it to the browser
$content= curl_exec($ch)
// close curl resource, and free up system resources
curl_close($ch);
return $content;
}
but get a parse error:
Parse error: syntax error, unexpected T_STRING in /home/.becka/simplein/bradvite.com/GoogleMapAPI.class.php on line 1340
Any help is much appreciated |
|
Back to top |
|
nmweb Smarty n00b
Joined: 29 Dec 2006 Posts: 2
|
Posted: Sat Jan 27, 2007 10:30 am Post subject: |
|
|
You need to add a ; somewhere. You can also cheat by using my adapted google maps class http://www.codeigniter.com/forums/viewthread/2649/
It extends the normal class and has a neater solution, that is, only if the setting for using file_get_contents for urls is disabled it uses cURL. |
|
Back to top |
|
|
|
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
|