Topic: API is not working
When I go to my-site.com/api/api.php I get the following errors:
Notice: Undefined variable: action in /var/www/vhosts/my-site.com/httpdocs/api/api.php on line 8
Notice: Undefined variable: action in /var/www/vhosts/my-site.php/httpdocs/api/api.php on line 15
Notice: Undefined variable: action in /var/www/vhosts/my-site.php/httpdocs/api/api.php on line 22
This is how my api.php looks:
<?php
require_once '../config.php';
define('JOBBER_URL',str_replace('api/','',BASE_URL));
escape($_GET);
switch($action)
{
case 'getJobs':
$params = array('type' => $type, 'category' => $category, 'count' => $count, 'random' => $random, 'days_behind' => $days_behind, 'response' => $response);
$api = new Api('getJobs', $params, $response);
$api->Display();
exit;
break;
case 'getJobsByCompany':
$params = array('company' => $company, 'count' => $count, 'response' => $response);
$api = new Api('getJobsByCompany', $params, $response);
$api->Display();
exit;
break;
case 'getJobs4JobJob':
if (!isset($since))
{
$since = date('Y-m-d');
}
$params = array('since' => $since, 'response' => 'xml');
$api = new Api('getJobs4JobJob', $params, 'xml');
echo $api->ReturnXml4JobJob();
exit;
break;
}
?>
Because of these errors I can't get my widgets working on any site. Anyone can help?
regards,
Ruben