jobsin

Topic: API is not working

When I go to my-site.com/api/api.php I get the following errors:

Code:

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:

Code:

<?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

Jobs in Belgium & Jobs in the Netherlands - Jobs that most people love!

Kiss

Re: API is not working

jobsin wrote:

When I go to my-site.com/api/api.php I get the following errors:

Code:

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:

Code:

<?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

I have the same issue please someone help us pls
But i am getting error on line 3 only
pls help
Regards

putypuruty

Re: API is not working

Hi!

Please see http://www.jobberbase.com/forum/post10017.html#p10017 for the solution