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

Fix sample API call url path

parent f4c39bd6
Branches
Tags
No related merge requests found
......@@ -16,12 +16,12 @@
**********************************************************************/
# 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)
#
$config = array(
'url'=>'http://yourdomain.com/support/api/task/cron',
'url'=>'http://yourdomain.com/support/api/tasks/cron',
'key'=>'API KEY HERE'
);
......@@ -32,8 +32,8 @@ function_exists('curl_version') or die('CURL support required');
set_time_limit(30);
#curl post
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');
curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7');
......@@ -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_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch);
$result=curl_exec($ch);
curl_close($ch);
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.
Please register or to comment