|
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 |
ClintR Smarty Rookie
Joined: 24 Jul 2010 Posts: 5
|
Posted: Sat Jul 24, 2010 11:12 pm Post subject: GoogleMapAPI getGeocode not working on production server? |
|
|
Greetings,
I'm using ver 2.5 with ZendFramework 1.10. On my local dev machine, I can pass a variable holding address info to getGeocode() and it gives me lat/lon coordinates as it should.
When I try it on my live site, it doesn't return anything and my map is blank.
When I echo out the lat/lon values, they appear in my view on local machine, but not on the live site.
Am I missing something completely obvious?
Thanks for any help! |
|
Back to top |
|
ClintR Smarty Rookie
Joined: 24 Jul 2010 Posts: 5
|
Posted: Sat Jul 24, 2010 11:24 pm Post subject: |
|
|
I'll post some code:
In my controller action:
Code: | //Make Map
$map = new GoogleMapAPI('map');
$map->setAPIKey('mykey');
$map->enableOnLoad();
$coords = $map->getGeocode($coordMap);
$lat = $coords['lat'];
$long = $coords['lon'];
$map->setCenterCoords($long, $lat);
$map->setZoomLevel(10);
$map->disableTypeControls();
$map->disableSidebar();
$map->setControlSize('small');
$map->setWidth('300px');
$map->setHeight('300px');
$this->view->map = $map; |
In my view:
Code: | echo $this->map->printMap();
$this->map->printOnLoad(); |
And of course, my header code:
Code: | if(Zend_Controller_Front::getInstance()->getRequest()->getActionName()=="view")
{
$this->map->printHeaderJS();
$this->map->printMapJS();
} |
As mentioned, the problem seems to be with getGeocode()...it just doesn't return anything when tried on a live server.
Thanks again for any help! |
|
Back to top |
|
ClintR Smarty Rookie
Joined: 24 Jul 2010 Posts: 5
|
Posted: Mon Jul 26, 2010 8:36 pm Post subject: |
|
|
Anyone?
I've tried just using it in a normal, procedural php script and still no luck.
Code: | $mapCoords = new GoogleMapAPI();
$coords = $mapCoords->getGeocode('1012 West State Road 436 Altamonte Springs, FL 32714');
var_dump($coords); |
From local machine: array(2) { ["lat"]=> string(10) "28.6652735" ["lon"]=> string(11) "-81.4234214" }
On a live server: bool(false)
Is there a PHP version requirement I've missed? My host has 5.2, while I'm running 5.3. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Jul 26, 2010 8:42 pm Post subject: |
|
|
There is nothing in GoogleMaps that needs changed. You need to figure out why your production server blocks the connection ( if it is? ), or maybe your production server is in a different geographic location that google doesn't allow the query? Who knows, you have to debug that part yourself.
[edit] another possibility, php allow_url_fopen may need to be enabled if it is not. Check your PHP error_logs, it should be obvious if that is the case. |
|
Back to top |
|
ClintR Smarty Rookie
Joined: 24 Jul 2010 Posts: 5
|
Posted: Mon Jul 26, 2010 9:21 pm Post subject: |
|
|
How can I find which geographic locations Google allows? My servers are in TX, so they're in the USA.
actually saw this in the error logs
Quote: | [26-Jul-2010 20:55:57] PHP Warning: file_get_contents(http://maps.google.com/maps/geo?&q=1012%20West%20State%20Road%20436%20Altamonte%20Springs%2C%20FL%2032714&output=csv&key=) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden |
It's on the Rackspace Cloud, which is a shared environment. Tech support is asking if the API has a limit on access by IP... |
|
Back to top |
|
ClintR Smarty Rookie
Joined: 24 Jul 2010 Posts: 5
|
Posted: Mon Jul 26, 2010 9:26 pm Post subject: |
|
|
allow_url_fopen is open according to phpinfo()
E: also, I guess any function that depends on an HTTP request to Google is failing here since passing a static address to the object to set a marker doesn't work either... |
|
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
|