Skip to content
Snippets Groups Projects
Commit 3dbddac0 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge branch 'issue/539' into develop

parents e8141623 976018d0
No related branches found
No related tags found
No related merge requests found
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
**********************************************************************/ **********************************************************************/
# Configuration: Enter the url and key. That is it. # Configuration: Enter the url and key. That is it.
# url => URL to api/task/cron e.g http://yourdomain.com/support/api/task/cron # url => URL to api/task/cron e.g http://yourdomain.com/support/api/tasks/cron
# key => API's Key (see admin panel on how to generate a key) # key => API's Key (see admin panel on how to generate a key)
# #
$config = array( $config = array(
'url'=>'http://yourdomain.com/support/api/task/cron', 'url'=>'http://yourdomain.com/support/api/tasks/cron',
'key'=>'API KEY HERE' 'key'=>'API KEY HERE'
); );
...@@ -32,8 +32,8 @@ function_exists('curl_version') or die('CURL support required'); ...@@ -32,8 +32,8 @@ function_exists('curl_version') or die('CURL support required');
set_time_limit(30); set_time_limit(30);
#curl post #curl post
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url']); curl_setopt($ch, CURLOPT_URL, $config['url']);
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, ''); curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7'); curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7');
...@@ -41,7 +41,7 @@ curl_setopt($ch, CURLOPT_HEADER, TRUE); ...@@ -41,7 +41,7 @@ curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key'])); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key']));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch); $result=curl_exec($ch);
curl_close($ch); curl_close($ch);
if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status) && $status[1] == 200) if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status) && $status[1] == 200)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment