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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:36:48+00:00 2026-05-30T15:36:48+00:00

framework is here http://luracast.com/products/restler/ i’m using restler as restful api for my work, when

  • 0

framework is here
http://luracast.com/products/restler/

i’m using restler as restful api for my work,
when i use backbone model save to a url, it sends and update my data as json by using ‘HTTP PUT’ request method, and i want to get a response from what i’ve putted…

if it’s a HTTP POST request method i can use

// to getting content from a POST
$post_data = json_decode(file_get_contents('php://input'), true);

to get my content, but cant get anything from HTTP PUT

// can't get anything from a PUT
function putpatients($id) {
    $post_data = file_get_contents('php://input');
    $post_data = json_decode($post_data, true);
    echo $post_data['name'];
}

the browser response blank

how do i return my data as json ???

  • 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-30T15:36:49+00:00Added an answer on May 30, 2026 at 3:36 pm

    As I commented on your question, php://input is a stream, if you read from it, it empties it.

    I’ve never used Restler before but looking at the few examples provided in their download, it seems to indicate the submitted data is automatically passed as a parameter to your put handler..

    In Restler’s crud example, the Author class has a put request like this:

    function put($id=NULL, $request_data=NULL) {
        return $this->dp->update($id, $this->_validate($request_data));
    }
    

    so i’m guessing that restler has already read the php://input stream, and hence emptied it.

    so, your put handler should maybe be more like in their example:

    function putpatients($id, $request_data = NULL) {
        /* do something with the $request_data */
        var_dump($request_data);
    }
    

    Edit: There’s actually a previous SO question from @deceze that talks about why reading twice from php://input doesn’t work – for PUT requests – which explains why your code worked with a POST request. Either way, you should really use the facility provided by Restler rather than re-inventing the rest wheel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using cocoa JSON framework http://code.google.com/p/json-framework/ Here is the result of an JSON output
i'm using Wurfl-adapter of Zend_Http_UserAgent as described here: http://framework.zend.com/manual/en/zend.http.user-agent.html Do I need to update
I'm using the basic framework of the a php login form provided here: http://www.html-form-guide.com/php-form/php-login-form.html
I have read the examples here: http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html But those examples assume the spreadsheet to
I'm following a tutorial on Zend Framework here (http://www.ibm.com/developerworks/opensource/tutorials/os-php-zend2/section2.html). I barely got started, but
I've downloaded the JSON framework DMG from http://code.google.com/p/json-framework/downloads/list . I followed Option 3 here:
Reading the section Zend_Application_Resource_Modules in the docs here: http://framework.zend.com/manual/1.10/en/zend.application.available-resources.html I noticed this: You can
I am using the SensioFrameworkExtraBundle located here http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html to allow for routes and template
I'm trying to use Flurry analytics in an IPad app as described here: http://blog.kevfoo.com/index.php/2010/08/monotouch-flurry-analytics-bindings/
I found a great walk-through for Sync Framework here: http://msdn.microsoft.com/en-us/library/bb726010.aspx But, it is using

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.