Phoogle and GoDaddy: a work-around
I was probably smacking my head against the wall to hard trying to figure out what the heck was wrong with my use of the Phoogle code (a very nifty PHP script which makes use of the Google Maps API) when I finally got around to moving a site I’ve been working on to its place on a production server - hosted on GoDaddy.com.
Needless to say, their tech support folks are less than terribly helpful, as they pointed out that Phoogle’s file_get_contents($apiURL.urlencode($address)); function, which calls out to the Google Maps web service, is not permitted on GoDaddy’s hosts. Tough cookies on that.
This makes a certain amount of sense from a security standpoint - having site (user) accessing and running remote scripts through the (GoDaddy’s) host could open doors to all sorts of unfriendly riff-raff who might want to do not-so-nice things.
The GoDaddy support guy gave me some workaround that involved using a proxy server for HTTPS (not particularly needed, and the workaround gave me headaches just looking at it — and that said, I may need to consider any future choice to host a site with them again - for reasons not related to the sensible-ness of the handling the security issue this way).
Anyways, I turned to my good friend, Google Search…
… which after a few hours of parsing the tech blogs and odd mailing list weirdness that it can turn up, such as helpful and well meaning folks telling the poor frustrated sod trying to get his Phoogle on a file_get_contents() shunning host to simply edit his web.config or php.config file with this or that tweak — yes, I’m sure that’s fine on my personal development box, but I suffer little delusions of getting within a bargepole’s length of accessing anything that looks like a .config file on my mass-marketed web host.
Eventually, after much wailing and gnashing of teeth, Google ‘fessed up this link to Alex Hillman’s Development blog, dangerouslyawesome.
Mr. Tillman’s workaround proved to not induce any migraines, because it replaced one line of code (the file_get_contents() function) with seven lines of somewhat awe-inspiring and imposing cURL functions.
It looked like this:
$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt($ch, CURLOPT_URL, $apiURL.urlencode($address));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$addressData = curl_exec($ch);
curl_close($ch);
Apparently this was originally designed to work with DreamHost… but it works on the GoDaddy host all the same.
I hope this helps someone else, as the power of the Interwebs propagates this about the Infotainment Super-Duper-Highway… as I sure do hate seeing other folks leave code-induced brainstains on the side of the walls.






This works for me. Maybe an oversight? Thanks for this blog post showing me how to do it… but I fear that publicizing it may result in it being disabled, breaking cool mashups all across the web
Comment by anonymous — 21 February 2008 @ 2:14 am