I have the following cURL function:
JavaScript
x
function getReferalURL($userMail){
$dataToSend = array(
'key: kewbhfbi87324y3rb3r2837r3brikbfwef23ibwjkfbkjfwkjfb',
'email:laura@hotmail.com'
);
$curl = curl_init();
$curlOptions = array(
CURLOPT_URL => 'https://api.leaddyno.com/v1/affiliates/by_email',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => false,
CURLOPT_HTTPHEADER => $dataToSend,
);
curl_setopt_array($curl, $curlOptions);
$afiliateData = curl_exec($curl);
if (!$afiliateData) {
return curl_error($curl);
} else {
return $afiliateData;
}
}
All that I’m getting as a response is that the email is missing.
I’ve read the documentation, all they have about this specific requisition is:
Definition: GET https://api.leaddyno.com/v1/affiliates/by_email
Curl:
JavaScript
$ curl https://api.leaddyno.com/v1/affiliates/by_email -G
-d email=example@example.com
-d key=[YOUR_PRIVATE_KEY]
That’s a dummy private key, of course. I would appreciate any help.
Advertisement
Answer
This:
JavaScript
$dataToSend = array(
'key: kewbhfbi87324y3rb3r2837r3brikbfwef23ibwjkfbkjfwkjfb',
'email:laura@hotmail.com'
);
is not the sort of array it’s expecting.
JavaScript
$dataToSend = array(
'key' => 'kewbhfbi87324y3rb3r2837r3brikbfwef23ibwjkfbkjfwkjfb',
'email' => 'laura@hotmail.com'
);
is likely what you need.