Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Facebook PHP Coding Issue

    Hi. When I request data from facebook, it returns it in a jSON response like this:

    {
    "data": [
    {
    "installed": 1,
    "read_stream": 1,

    }
    ]
    }


    Next I use "$fb_response = json_decode($requests, true);", which has worked for all other Facebook requests.

    I try to store the field "read_stream" data in my array-
    $user["read_stream"] = $fb_response->{"read_stream"};

    but I can't get it to work. What am I doing wrong?

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,339
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    I think you're using json_decode the wrong way and expecting an object.

    Try $fb_response['read_stream']; instead of using the -> object thing.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •