That is exactly right. Although i initially found the whole zend_http_client
concept quite daunting, i found a nice screencast on using zend framework
with the google maps api which does exactly as you say. I modified slightly
and used it as an adapter on my model. Works beautifully!



prodigitalson wrote:
> 
> 
> 
> tony stamp wrote:
>> 
>> Thanks ant, that was almost exactly what i was aiming for.
>> 
>> But i've been reading a lot about the downsides of the actionstack, and
>> also feel that the process of geocoding the address should be a behaviour
>> of the model itself. I will be using the google API to obtain the acutal
>> geocodes, but was wondering how to make a call to the google API using
>> the zf - an external request, so to speak?
>> 
> 
> Well that depends on what functionality you need... specifically, but if i
> understand your question correctly it doesnt have anything to do with
> Zend_Controller. You would make this call with Zend_Http_Client or some
> other HTTP client class, use the raw CURL or fopen functions in php, or
> use an external process with wget or something similar. 
> 
> This would all be implemented in the Class responsible for the Geocoding
> (My_GoogleApi_Geocode) in the example... Actually im not sure if the GData
> components in zend already handle this or not - i havent even looked at
> them yet but they may already contain the logic you need.
> 
> So you pass in the address to the geocoder class and it does the
> following:
> - Creates and url for the googleapi to geocode the supplied address
> - sets up a php HTTP client of some sort
> - Fires off a request with the HTTP client to the googleapi url
> - parses the response from google and puts the lat and lng in an array
> - returns that array
> 
> 

-- 
View this message in context: 
http://www.nabble.com/calling-controller-action-and-getting-json-response-from-seperate-controller-tp25982645p26024709.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to