ZF-8615: Twitter geo information not parsed

Issue Type: Bug Created: 2009-12-22T11:36:19.000+0000 Last Updated: 2012-11-20T21:38:15.000+0000 Status: Open Fix version(s): Reporter: Darren Lucas (vtwo) Assignee: None Tags: - Zend_Service_Twitter

Related issues: Attachments:


The geotagging information isn't parsed properly from a tweet with geo information attached. There is a geo array item returned in the result object but it is empty.

I would guess this is due to the geo information belonging to a different namespace, below is a snippet:"> 54.39790844 -1.85352928


Posted by Darren Lucas (vtwo) on 2009-12-22T13:28:01.000+0000

After looking at this further, it seems this issue may actually be a problem with Zend_Rest_Client_Response and SimpleXML needing namespaces to be registered before xpath will read them.

The following code will at least get the coordinates out:

<pre class="highlight">

// Get User Timeline
$twitter = new Zend_Service_Twitter('username','password');
$response = $twitter->status->userTimeline();

// Register Namespaces
$simpleXml = $response->getIterator();
$namespaces = $simpleXml->getNamespaces(true);
foreach ($namespaces as $prefix => $ns) {
    $simpleXml->registerXPathNamespace($prefix, $ns);

// Print list of geo tags if they exist

I haven't got as far as trying to patch Zend_Rest_Client_Response to return namespaced elements, but the above code should at least help with demonstrating the problem and / or help someone with implementing a fix.

Posted by Darren Lucas (vtwo) on 2009-12-22T13:33:23.000+0000

^ and when I say Zend_Rest_Client_Response I really mean Zend_Rest_Client_Result

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.