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

using GoogleMapAPI without file_open_contents

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
spaceapple
Smarty n00b


Joined: 27 Jan 2007
Posts: 2

PostPosted: Sat Jan 27, 2007 7:32 am    Post subject: using GoogleMapAPI without file_open_contents Reply with quote

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
View user's profile Send private message
spaceapple
Smarty n00b


Joined: 27 Jan 2007
Posts: 2

PostPosted: Sat Jan 27, 2007 7:32 am    Post subject: Reply with quote

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
View user's profile Send private message
nmweb
Smarty n00b


Joined: 29 Dec 2006
Posts: 2

PostPosted: Sat Jan 27, 2007 10:30 am    Post subject: Reply with quote

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
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
Page 1 of 1

 
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