Php uses curl, and the counterpart is also php. How can I get it?

I wrote an api
hypothesis called sql.php

myself.

I am in another sql-test.php

$data = array(
  "errno" => "1",
  "errstr" => "2",
  "errfile" => "3",
  "errline" => "4"
);
$data_string = json_encode($data);
$data = httpRequest($api_sql, $data_string);

httpRequest is

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));

I am json past sql.php, and POST
but how can I write my sql.php to receive it?

sql.php has a paragraph

(addtime, errno, errstr, errfile, errline)
    VALUES
    ("".time()."", "".$_POST["errno"]."", "".$_POST["errstr"]."", "".$_POST["errfile"]."", "".$_POST["errline"]."")

results the database only received time ()
the values of the other four digits did not receive (1234)
sql.php. How to write this? To receive the value from sql-test.php?

Mar.04,2021

you need to take the value in php://input
or take the json_encode off the array when you pass it.
if you receive it, take the normal $_ POST

.
Menu