Breaking my head on simple XML

So, I have written some very basic PHP that gets my latest tweet and it’s geolocation. The thing is: it works half of the time. I have been trying to figure this out for hours and can’t seem to find what’s wrong!

<?php $timelineXML = simplexml_load_file(''); $text = $timelineXML->status->text; $geo = $timelineXML->status->geo; $point = $geo->children('')->point; $pointCoordinates = explode(" ", $point); $pointLat = $pointCoordinates[0]; $pointLng = $pointCoordinates[1]; echo 'Text: '.$Text."\n"; echo 'Point Lat: '.$PointLat."\n"; echo 'Point Lng: '.$PointLng."\n"; ?>

At first I thought the problem was on twitter. But after some trouble shooting I found out that this wasn’t true. The API call is functioning as normal, and the XML returned is perfectly fine!

Any suggestions?

Sponsor our Newsletter | Privacy Policy | Terms of Service