Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6770555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:19:34+00:00 2026-05-26T15:19:34+00:00

I’m making FQL calls using the following url and then making a curl call.

  • 0

I’m making FQL calls using the following url and then making a curl call.

$url = ‘https://api.facebook.com/method/fql.query?access_token=’.$access_token.’&query=’.rawurlencode($query).’&format=JSON’;

and I then pass the returned data through a json_decode call

I’ve got this query:

SELECT name,page_id,page_url FROM page WHERE page_id IN (SELECT page_id FROM page_admin WHERE uid= $uid )

which returns a list of the names and pages for which the specified UID is an administrator.

On some PHP installs (and I’ve not been able to narrow it down) the page_id is turned from a long integer into a scientific notation – so 174311849258492 is returned as 1.7431184925849E 14 which of course breaks things.

As I can’t reproduce this on my server I’m not sure where the conversion is happening. Digging around I’ve found a suggestion that doing this:

json_decode( preg_replace(‘/:(\d+,)/’, ‘:”${1}”,’, $response ) );

will fix it

But why do some json_decodes cast into scientific notation for no apparent reason?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:19:35+00:00Added an answer on May 26, 2026 at 3:19 pm

    As Danny pointed out its a 32/64 bit issue. FB assume that everything is 64 bit and pass back an integer for this value rather than a string.

    So what you need to do is take the integers and convert them to strings BEFORE pulling them from the JSON array. Page IDs and Group IDs are passed as integers (Facebook user IDs are passed as strings)

    The code to do this is:

        $response = curl_exec($ch);
        $err_no=curl_errno($ch);
        curl_close($ch);
        $response=preg_replace('/"gid":(\d+)/', '"gid":"$1"', $response );
        $response=json_decode( preg_replace('/"page_id":(\d+)/', '"page_id":"$1"', $response ) );
        if (isset($response->message)) { 
            throw new Exception ($response->message);
        }
        return( $response);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.