Post data and retrieve the response using PHP Curl? -


i'm new working web services, , i'm finding pretty confusing.

if have url i'm trying post json data to, understand how using curl php method.

what i'm wondering is, if this, , url has kind of server response.. how response in php , use take different actions within php accordingly?

thanks!

-elliot

you'll have set curlopt_returntransfer option true.

$ch = curl_init($url);  curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $params); curl_setopt($ch, curlopt_returntransfer, true); $result = curl_exec($ch);  curl_close($ch); 

the response request available in $result variable.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -