Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
Created February 28, 2014 17:56
Show Gist options
  • Save saltlakeryan/9276148 to your computer and use it in GitHub Desktop.
Save saltlakeryan/9276148 to your computer and use it in GitHub Desktop.
RT Request Tracker API Call in PHP
<?php
//set POST variables
$url = 'https://myhost/rt-path/REST/1.0/search/ticket';
$fields = array(
'user' => ('rtuser'),
'pass' => ('rtpass'),
'format' => ('l'), //long format
'query' => ("Queue='mysupportqueue' and status !='resolved' and Created > '2013-03-10'")
);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, 2); //man in the middle attack here
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); //man in the middle attack here
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment