I try to get data from a JSON URL via PHP & curl.
how can I decode the "message" field?
"status" works great with $result->status
Does anyone have an idea for me?
API JSON Format
"messages":
[
    {
        "id":30,
        "message":"Service ID not provided!"
    },
    {
        "id":32,
        "message":"Service does not exist."
    }
]
<?php
$url = 'https://www.youtube.com/watch?v=';
$quantity = '10';
$id_service = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.kkkkkkkkk.com/v1-api");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Incase things are slow allow enough time to try.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Can cause unexpected/no return
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);// Can cause unexpected/no return
$data = array(
    /* Required */
    'api_key' => "22",
    'action' => 'add',
    'url' => $url,
    'quantity' => $quantity,
    'id_service' => $id_service,
);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = json_decode(curl_exec($ch));
?>
Edit: Answers works but not on my script .. any ideas why i get no response on "message" ?
 
    