Hello
I would like help with integrating with webService via url, for example:
$list_result = '{"titulo": '.
'[{"id":$id_primary}'.
']}';
$json = json_encode($list_result);
//echo $json;
//API Url
$url = 'https://local-que-devo-enviar.com.br/arquivo';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json))
);
//retorno
$jsonRet = json_decode(curl_exec($ch));
var_dump($jsonRet);
- I would like help to understand if I am mounting the data array correctly, how do I get a return and if the code stays that way. Because I'm not getting return from webservice ...