Sunday, August 26, 2012

Facebook ID’s returns as float values when using JSON

So I was testing out geolocation to get the closest places around the user’s current location and it returned an array! Awesome!!!! “Oh wait a minute. The page_id looks like xxxxxxxxE+14. Come on!”

I knew this is not going to work and I just want a regular string. Here is the fix. If you are using PHP 5.4 or higher you can use this.

$array = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);


If you are using >PHP5.4 then you must modify some things. 


First open the base_facebook.php and do a find for the _graph function. 


For me it was around line 850. Add this to the function:


$params[‘format’] = ‘json-strings’;


Then go back to the file where you are calling the array and add this to the end of your FQL url:


&format=json-strings


So it should look something like this:



$fql = 'SELECT page_id,name,description,display_subtext FROM place WHERE distance(latitude,longitude,"x","y")< 10000 AND checkin_count>0 ORDER BY checkin_count DESC LIMIT 20';

$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=' . urlencode($fql) . '&access_token=' . $at . "&format=json-strings";


That’s it!

Friday, August 24, 2012

Monster Jobs: ASP.net is everywhere!

I was looking through monster recently for developer jobs and a required skill set is ASP.net! I did see some PHP ones but, ASP was everywhere. Guess I need to take a dive into ASP to be a well rounded developer.

Train is at station!!!!

Home sweet home!