Link to home
Start Free TrialLog in
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

SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ray Zuchowski
Ray Zuchowski

ASKER

Awesome thank you
Both good and appropriate comments.