Add external api
Hi,
I would like to add a simple calculator API on my homepage. How can I add this code:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.thesgdiet.com/wp-json/simple_api/v1/call?apikey=<YOUR API KEY>&email=<YOUR API EMAIL>&age=<age>&height=<height>&weight=<weight>&gender=<Male|Female>&goal=<goal>&activelevel=<activelevel 1-4>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Thanks!
-
HI Anouk,
Thank you for reaching out to us.
I assume that this can be added to the functions.php file on WordPress; however, it's best to contact the developers of this code for proper guidance.
Best regards,
Ariel H.0
Please sign in to leave a comment.
Comments
1 comment