10 defined(
'JPATH_PLATFORM') or die();
34 public function getProfile($id = null, $url = null, $fields = null, $type =
'standard', $language = null)
36 $token = $this->oauth->getToken();
40 'oauth_token' => $token[
'key']
44 $base =
'/v1/people/';
46 $data[
'format'] =
'json';
61 $base .=
'url=' . $this->oauth->safeEncode($url);
64 if (!strcmp($type,
'public'))
73 $base .=
':' . $fields;
80 $header = array(
'Accept-Language' => $language);
84 $path = $this->getOption(
'api.url') . $base;
87 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data, $header);
89 return json_decode($response->body);
105 public function getConnections($fields = null, $start = 0, $count = 500, $modified = null, $modified_since = null)
107 $token = $this->oauth->getToken();
111 'oauth_token' => $token[
'key']
115 $base =
'/v1/people/~/connections';
117 $data[
'format'] =
'json';
122 $base .=
':' . $fields;
128 $data[
'start'] = $start;
133 $data[
'count'] = $count;
139 $data[
'modified'] = $modified;
145 $data[
'modified-since'] = $modified_since;
149 $path = $this->getOption(
'api.url') . $base;
152 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
154 return json_decode($response->body);
189 public function search($fields = null, $keywords = null, $first_name = null, $last_name = null, $company_name = null,
190 $current_company = null, $title = null, $current_title = null, $school_name = null, $current_school = null, $country_code = null,
191 $postal_code = null, $distance = null, $facets = null, $facet = null, $start = 0, $count = 10, $sort = null)
193 $token = $this->oauth->getToken();
197 'oauth_token' => $token[
'key']
201 $base =
'/v1/people-search';
203 $data[
'format'] =
'json';
208 $base .=
':' . $fields;
214 $data[
'keywords'] = $keywords;
220 $data[
'first-name'] = $first_name;
226 $data[
'last-name'] = $last_name;
232 $data[
'company-name'] = $company_name;
236 if ($current_company)
238 $data[
'current-company'] = $current_company;
244 $data[
'title'] = $title;
250 $data[
'current-title'] = $current_title;
256 $data[
'school-name'] = $school_name;
262 $data[
'current-school'] = $current_school;
268 $data[
'country-code'] = $country_code;
274 $data[
'postal-code'] = $postal_code;
280 $data[
'distance'] = $distance;
286 $data[
'facets'] = $facets;
292 $data[
'facet'] = array();
293 for ($i = 0; $i < count($facet); $i++)
299 $data[
'facet'][] =
'location,' . $facet[$i];
303 $data[
'facet'][] =
'industry,' . $facet[$i];
307 $data[
'facet'][] =
'network,' . $facet[$i];
311 $data[
'facet'][] =
'language,' . $facet[$i];
315 $data[
'facet'][] =
'current-company,' . $facet[$i];
319 $data[
'facet'][] =
'past-company,' . $facet[$i];
323 $data[
'facet'][] =
'school,' . $facet[$i];
332 $data[
'start'] = $start;
338 $data[
'count'] = $count;
344 $data[
'sort'] = $sort;
348 $path = $this->getOption(
'api.url') . $base;
351 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
353 if (strpos($fields,
'api-standard-profile-request') ===
false)
355 return json_decode($response->body);
359 $name = explode(
'"name": "', $response->body);
360 $name = explode(
'"', $name[1]);
364 $value = explode(
'"value": "', $response->body);
365 $value = explode(
'"', $value[1]);
369 $url = explode(
'"url": "', $response->body);
370 $url = explode(
'"', $url[1]);
374 $header[$name] = $value;
377 $response = $this->oauth->oauthRequest($url,
'GET', $parameters, $data, $header);
379 return json_decode($response->body);