0

I had a curl request to post a data to external system, the curl will response the success true/false message after curl process finished, and return the success responses

{"success":false,"error":{"code":"Accounts:-3","message":"[Invalid Post Title]"}}

Within this response I want to store "message":"[Invalid Post Title]" into my response_state field, but so far the insert not expected.

what so far i tried to achieve this

First

curl_setopt_array($curl, array(
........
$result = curl_exec($curl);
$results = json_decode($result->error[0]->message);

all this value inserted DB:

{"success":false,"error":{"code":"Accounts:-3","message":"[Invalid Post Title]"}}

Second

$result = curl_exec($curl);
$results = utf8_encode($result,true);

I got error 500

here the query for insert

$conn = mysqli_connect($host, $user, $pass, $db) or die ("Connection Failed")
$mysqli  = "INSERT INTO log (userid, status) 
VALUES ('$userid', '$status')";

Really appreciate for any comment or tutorial link, try to explore on net but still cannot found.

Thank

0 Answers0