Last active
November 8, 2016 13:01
-
-
Save Arcath/ccf0c7259075a571b8a3436d20ad3379 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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