This is one of my first curls code, so it can have mistakes
I'm trying to be able to make calls to form/:id/submissions https://www.formstack.com/developers/api/resources/submission#form/:id/submission_GET
If I load:
If works great.
If I try this code:
<?php
$host = 'https://www.formstack.com/api/v2/';
// TODO this should manage dinamics values or build an action in every method.
$action = 'form/1311091/submission.json';
$url = $host . $action;
// TODO this values will arrive like an array with values
$postData['oauth_token']= 'abc';
$postData['min_time'] ='2012-09-01 00:01:01';
$postData['max_time'] ='2012-10-27 00:01:01';
// TODO make a method with this action
function getElements($postData)
{
$elements = array();
foreach ($postData as $name=>$value) {
$elements[] = "{$name}=".urlencode($value);
}
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $elements);
$result = curl_exec($curl) ;
curl_close($curl);
var_dump($result);
?>
You'll need to set:
As an option before curl_exec() if you wish to get data back.
Also, why are you trying to send POST data via a GET request?
Also, for debugging, you should check out: