forms - How to set curl into php -


this form.

<form action="mail.php" method="post">     <label class="form-label" for="name">full name</label>     <input class="user" type="text" name="name" id="name">      <label class="form-label" for="email">email id</label>     <input class="email" type="email" name="email" id="email"> </form> 

how can set curl code php form?

create new user users can created or updated via post method https://api.intercom.io/users, accepts json object describing user.

example request:

curl https://api.intercom.io/users \   -x post \   -u app_id:api_key \   -h 'accept: application/json' \   -h 'content-type: application/json' -d '   {   "email": "hello@projectmap.io"   }' 

i hope work,

if(isset($_post['email'])) {     $url = 'https://api.intercom.io/users';     $array=array('email'=>$_post['email']);     $headers = array(                         'accept: application/json',                         'content-type: application/json'     );     $ch = curl_init();     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_returntransfer, true);     curl_setopt($ch, curlopt_customrequest, 'post');     curl_setopt($ch, curlopt_httpheader, $headers);     curl_setopt($ch, curlopt_postfields,  json_encode($array));     curl_setopt($ch, curlopt_userpwd, 'app_id:api_key');     $result = curl_exec($ch);     curl_close($ch);     print_r($result); }   

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -