Simple Formstack API Example

Formstack example using curl.


$host = 'https://www.formstack.com/api/v2/';

$action = 'form/YOURFORMIDHERE/submission.json';

$url = $host . $action;

$postData = array(

'field_31533672' => 'test@test.com',

);

$headers = array(

'Authorization: Bearer YOUR_OATH_TOKEN_HERE',

'Accept: application/json',

);

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_POST, 1);

curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);

$result = curl_exec($curl);

curl_close($curl);

var_dump($result);

Comments