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

  • Home
  • SEARCH
  • 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 8900435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:05:56+00:00 2026-06-15T01:05:56+00:00

I am new to JSON and having a problem with checking at getting the

  • 0

I am new to JSON and having a problem with checking at getting the error message when there is an error. My code works fine when the result is not an error, so I do somewhat understand what I am doing.
This is the error JSON that I am trying to parse:

{
   "error": {
      "message": "Unsupported get request.",
      "type": "GraphMethodException",
      "code": 100
   }
}

Here is my code that fails:

$jsonurl = "http://graph.facebook.com/JubilationDanceMinistry";
//valid $jsonurl = "http://graph.facebook.com/WhitworthACM";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json);

var_dump($json_output);
// This returns NULL


if (property_exists($json_output->error)) {
        echo "<p>error: $json_output->error->{'message'} </p>";
    } else {
        echo "<p>no error :(</p>";
}

$facebook_id = $json_output->{'id'};
$facebook_name = $json_output->{'name'};
$facebook_link = $json_output->{'link'};
  • 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-06-15T01:05:57+00:00Added an answer on June 15, 2026 at 1:05 am

    Because the url returns the 400 Bad Request.

    By default, you can’t use file_get_contents function to get the response content when the http status code is 400.

    You need to set ignore_errors options to true.

    $opts = array(
      'http'=>array(
        'ignore_errors' => true
      )
    );
    $context = stream_context_create($opts);
    $jsonurl = "http://graph.facebook.com/JubilationDanceMinistry";
    $json = file_get_contents($jsonurl, false, $context);
    var_dump($json);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with getting json data. I created 2 examples. One works,
I'm having a very annoying problem using Facebook's sign-on. It works perfectly fine when
I'm having a problem. I have a json code as below. I want to
I'm new to Ember and I'm having a problem loading JSON from a URL.
I am having a problem with getting back the response from my PHP code.
I'm trying to create this JSON string but having problem creating it. I'm getting
Am having a problem reading/parsing the following JSON string in Java. Code: try{ json
I am having a problem with the below code and I am not sure
I'm new to Python and I'm having a problem viewing error messages: I have
I'm new to iOS development and I'm having trouble making a simple Json POST

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.