Avatar of Ray Zuchowski
Ray Zuchowski

asked on 

How to Figure out HTTP POST CURL Output

Here is my script which works fine, what im trying to figure out is , how is the url constructed. Is there a way to echo what Curl is outputting to the API ?


<?php
/*** Mandatory data ***/ 
// Post URL 
$postURL = "http://mywebsite.com"; 
// The Secret key 
$secretKey = "57f4354356gfhf54"; 

/*** Optional Data ***/ 
//$firstname = "John"; 
//$lastname = "Doe"; 
//$email = "john.doe@gmail.com"; 

// prepare the data 
$data = array (); 
$data['secret_key'] = $secretKey; 
$data['slm_action'] = 'slm_check'; 
$data ['license_key'] = '5435436547frgfd';

// send data to post URL 
$ch = curl_init ($postURL); 
curl_setopt ($ch, CURLOPT_POST, true); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); 
$returnValue = curl_exec ($ch); 

// Process the return values 
print_r($returnValue);
?>

Open in new window

PHPHTML

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon