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 7663163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:59:20+00:00 2026-05-31T13:59:20+00:00

I am trying to json_decode the response I receive from a GET request to

  • 0

I am trying to json_decode the response I receive from a GET request to my server-side API but I am getting an empty string back. Would I be right in assuming that because the response contains all the header info that the JSON decoder cant cope? This is the full response I’m getting from my server:

HTTP/1.1 200 OK
Server: nginx/1.0.5
Date: Sun, 18 Mar 2012 19:44:43 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: Servlet/3.0; JBossAS-6
Content-Length: 97

{"pid":"162000798ab8481eaeb2b867e10f8849","uuid":"973b8722c75a4cacb9fd2316517587bb"}

Do I need to remove the headers in my servlet before I send the response to the client?

  • 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-31T13:59:22+00:00Added an answer on May 31, 2026 at 1:59 pm

    Yes, json_decode must be passed just the JSON data to decode. Since you are using curl, you can simply configure the request to not return the headers to you with something like

    curl_setopt($ch, CURLOPT_HEADER, false);
    

    Update: if you need the headers for earlier processing then the above won’t cut it. However, you can remove them easily at any point by taking advantage of the fact that there will be a double-newline “delimiter” between the header and body of the response. Using explode like this will then isolate the body:

    list(,$body) = explode("\n\n", $response, 2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse this json data from the url but i get
I am trying to decode the Google Dictionary API JSON response with PHP, but
I'm trying to parse the json signed_request you receive from Facebook in perl but
I'm trying to handle a JSONP request server side for a form submission ie.
I'm trying to return json content read from MySQL server. This is supposed to
I am trying to use Ext.Ajax.request in ExtJS 4.02a but it will not run
I'm trying to parse json data from google directions but can't seem to access
I am trying to decode a JSON string using json_decode() in PHP. Part of
I'm trying to decode JSON received from twitter streaming API using JSONConvert from NewtonSoft.Json
I'm trying to get some JSON data from a url like this: $url =

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.