0

I have a problem in my CI framework website. My AJAX (client) calls a ReSTful API (server) with PUT method.

In Server. I use :

putfp = fopen('php://input', 'r');
$putdata = '';
while($data = fread($putfp, 1024))
  $putdata .= $data;
fclose($putfp);
parse_str($putdata, $output);
echo $output['name'];

And I had a value of $name from client. e.t.c for other variable. But in document guide of this Framework, they said like this: https://www.codeigniter.com/user_guide/libraries/input.html#using-the-php-input-stream

My question is:

How to use $this->input->raw_input_stream;

Because I want to do like document guide said. I tried and result was all error. I don't know where I should put $this->input->raw_input_stream; into and how to get the data with that.

Anyone help me with example?

1
  • Remove junk, format the post Commented Dec 27, 2017 at 8:50

1 Answer 1

1

You can try PHP built in, file_get_contents('php://input') method.

OR

Refer this URL https://www.codeigniter.com/user_guide/libraries/input.html#using-the-php-input-stream

Hope this can help you.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.