We help IT Professionals succeed at work.
Get Started

How to Figure out HTTP POST CURL Output

Ray Zuchowski
Last Modified: 2016-10-26
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 ?

/*** 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 

Open in new window

Watch Question
Fixer of Problems
Most Valuable Expert 2014
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE