Skip to content

Instantly share code, notes, and snippets.

@Arcath
Last active November 8, 2016 13:01
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 Arcath/ccf0c7259075a571b8a3436d20ad3379 to your computer and use it in GitHub Desktop.
Save Arcath/ccf0c7259075a571b8a3436d20ad3379 to your computer and use it in GitHub Desktop.
<?php
$config = array(
'url'=>'https:/yoursite.com/api/tickets.json',
'key'=> $_POST['apiKey']
);
$data = array(
'name' => $_POST['name'],
'email' => $_POST['email'],
'subject' => $_POST['subject'],
'message' => $_POST['message'],
'ip' => $_SERVER['REMOTE_ADDR'],
'topicId' => '19' // Change to the id of your default topic.
);
set_time_limit(30);
$options = array(
'http' => array(
'header' => "X_API_Key: ".$config['key'],
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($config['url'], false, $context);
if ($result === FALSE) { die("FAILED"); }
echo($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment