Skip to content

Instantly share code, notes, and snippets.

@customerguru
Last active September 10, 2016 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save customerguru/0fe98ad1a07c2793dee95fad77f8a431 to your computer and use it in GitHub Desktop.
Save customerguru/0fe98ad1a07c2793dee95fad77f8a431 to your computer and use it in GitHub Desktop.
Documentation available at https://customer.guru/api/documentation
<?php
//
// https://customer.guru/api/documentation
//
$url = 'https://customer.guru/api/v1/survey';
$parameters = array(
'api_token' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'api_secret' => 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
'emails' => implode(array('juraj@customer.guru', 'niceapi@customer.guru'), ','),
'scheduled_for' => 'now',
'test' => 'false'
);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'method' => 'POST',
'content' => http_build_query($parameters)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
$error = error_get_last();
print_r($error);
}
var_dump($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment