i have a distant api service which ask for all our requests:
Accept: application/json
clientname: {mynamevalue}
clientsecret: {mysecretvalue}
The first command available is name 'get_contacts'
The http request is GET https://www.example.com/api/contacts
For what i understand you cant send a body with the parameters $clientname
and $clientsecret
.
You can only do that:
https://www.example.com/api/contacts/?clientname=aaaaaa&clientsecret=bbbbb
Am i right?
Or is it possible to send a json structure in a get request? How to do with php?
Thanks all Good evening
I tried
https://www.example.com/api/contacts/?clientname=aaaaaa&clientsecret=bbbbb
not working and :
$url = 'https://www.example.com/api/contacts/?clientname='.urlencode($login).'& clientsecret='.urlencode($password);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$response = curl_exec($ch);