Question

I built a custom wordpress widget months ago that just pulls a users facebook events, styles and shows it in the sidebar. The events are still showing up fine - except that the links now go to an facebook error page. So I checked the echo'd url and this is what I got :

https://www.facebook.com/events/4.3772330960996E+14

Obviously the url, ending at events/ is hard-coded and the number that follows is an echo is a for loop. Which has been working clean for about 6mo.

At first I thought maybe it was returning an Integer that was being converted somehow.. but I checked the actual event id from facebook.com and this is what is was:

437723309609959

I think fb api is putting a decimal point where it had never been before.

Just to clarify: I am using PHP - using FQL through the GRAPH with CURL. And then echoing the raw row info.

Thoughts?

Was it helpful?

Solution

Change your precision setting in php.ini, or directly in code:

ini_set('precision', 20);

OTHER TIPS

You must be using a 32-bit version of PHP, where the largest integer is 2147483647

Try using printf instead of echo:

printf('http://graph.facebook.com/events/%s', $eid);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top