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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:23:33+00:00 2026-06-12T04:23:33+00:00

Possible Duplicate: Parse Json in php I am working with an API that sends

  • 0

Possible Duplicate:
Parse Json in php

I am working with an API that sends a POST request to my PHP script when a user performs an action. I can easily log the raw POST data to a file, for example:

$rawPostData = file_get_contents('php://input');
$all = date("F j, Y, g:i a") . " " . $rawPostData . "\r\n";
file_put_contents("Activity.log", $all, FILE_APPEND);

Writes this to the log file:

October 1, 2012, 12:34 pm [{"changed_aspect": "media", "subscription_id": 2421759, "object": "user", "object_id": "931456", "time": 1349120084}]

The only thing I am interested in is the object_id value. How can I access this value in the raw POST data? I’ve tried a ton and searched a number of forums for a solution. It seems simple enough but I can’t seem to get it. Any ideas?

  • 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-12T04:23:34+00:00Added an answer on June 12, 2026 at 4:23 am

    Your post data is JSON so use json_decode to turn it into an array containing anobject and access the object_id property

    $rawPostData = file_get_contents('php://input');
    $json = json_decode($rawPostData);
    $json = $json[0];
    $all = date("F j, Y, g:i a") . " " . $json->object_id. "\r\n";
    file_put_contents("Activity.log", $all, FILE_APPEND);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Parse error on explode('-','foo-bar')[0] (for instance) In PHP there are functions that
Possible Duplicate: How to retrieve JSON via ASP.Net context.Request Im trying to parse an
Possible Duplicate: Parse Json in php I was looking for this awnser but couldnt
Possible Duplicate: How to parse JSON in JavaScript { data: [ { name: JoongBum
Possible Duplicate: How to parse JSON in JavaScript I have this JSON string: [{title:
Possible Duplicate: How can I parse JSON in Google App Engine? json module was
Possible Duplicate: jQuery won't parse my JSON from AJAX query So I have parsed
Possible Duplicate: How to parse and process HTML with PHP? I am brand new
Possible Duplicate: How to parse and process HTML with PHP? I have HTML document
Possible Duplicate: How to parse JSON in JavaScript Hi I have to parse the

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.