function test_connecting()
 {
     $key = $_POST['key'];
     if ($key) {
         $api = $this->get_settings();
         extract($api);
         $api_key = isset($api['api_key']) ? trim($api['api_key']) : '';
         $secret_key = isset($api['secret_key']) ? trim($api['secret_key']) : '';
         $token = isset($api['token']) ? trim($api['token']) : '';
         $token_secret = isset($api['token_secret']) ? trim($api['token_secret']) : '';
         $API_CONFIG = array('appKey' => $api_key, 'appSecret' => $secret_key, 'callbackUrl' => NULL);
         $TOKEN_CONFIG = array('oauth_token' => $token, 'oauth_token_secret' => $token_secret);
         $linkedin = new WP_LinkedIn_LinkedIn($API_CONFIG);
         $linkedin->setTokenAccess($TOKEN_CONFIG);
         $linkedin->setResponseFormat(WP_LinkedIn_LinkedIn::_RESPONSE_XML);
         $response = $linkedin->searchJobs('?keywords=quality&count=1');
         if ($response['success'] === true) {
             echo 'Connected successfully. Now you can import linkedin jobs into your job board.';
         } else {
             $err = simplexml_load_string($response['linkedin']);
             echo 'Erorr: ' . $err->message . '. Please check your LinkedIn API ';
         }
     }
     //echo json_encode($response);
     die;
 }
 public function linkedin_job_sync($search_str)
 {
     $api = $this->get_settings();
     extract($api);
     $api_key = isset($api['api_key']) ? trim($api['api_key']) : '';
     $secret_key = isset($api['secret_key']) ? trim($api['secret_key']) : '';
     $token = isset($api['token']) ? trim($api['token']) : '';
     $token_secret = isset($api['token_secret']) ? trim($api['token_secret']) : '';
     $API_CONFIG = array('appKey' => $api_key, 'appSecret' => $secret_key, 'callbackUrl' => NULL);
     $TOKEN_CONFIG = array('oauth_token' => $token, 'oauth_token_secret' => $token_secret);
     $linkedin = new WP_LinkedIn_LinkedIn($API_CONFIG);
     $linkedin->setTokenAccess($TOKEN_CONFIG);
     $linkedin->setResponseFormat(WP_LinkedIn_LinkedIn::_RESPONSE_XML);
     $response = $linkedin->searchJobs(':(jobs:(id))?' . $search_str . '&count=20');
     $data = simplexml_load_string($response['linkedin']);
     if ($response['success'] === TRUE) {
         $xml = $this->create_xml_custom($data);
         return $xml;
     } else {
         return array('error' => $data->message, 'total' => 0);
     }
 }