0

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?

Kara
  • 6,115
  • 16
  • 50
  • 57

2 Answers2

1

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

ini_set('precision', 20);
dev-null-dweller
  • 29,274
  • 3
  • 65
  • 85
0

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);
cpilko
  • 11,792
  • 2
  • 31
  • 45
  • Thank you for the quick response. I tried your method and it returned the same value as when I tried (int) and intval. http://graph.facebook.com/events/1717711072 – Johnny Gigantic Nov 09 '12 at 18:57
  • Try changing `%d` above to `%s`. I just looked through an events scraper I wrote for a site of mine and using that code works. I've got 32-bit PHP, and 15-character long `eid` strings are rendering correctly. On my server, `ini_get('precision')` = 14. – cpilko Nov 09 '12 at 19:40