retrieve linkedin profile url from php api -
i using simple linkedin php library create searching feature application. user can search through linkedin , retrieve matched users information. of right feature working properly, how can parse xml returned api , user's id create link profile?
this sample of array returned api call:
{ "numresults": 17325, "people": { "_count": 10, "_start": 0, "_total": 110, "values": [ { "firstname": "leon", "headline": "digital marketing | mobile marketing | video marketing | seo/sem | digital media sales trainer", "id": "efmhqotad3", "lastname": "e. spencer", "pictureurl": "http://m3.licdn.com/mpr/mprx/0_jogihrinvw_afca6prdyhpxzbdvfi3a6xywyhpxke7t0p5jql4sfq1kemxzr86fopjxjfqnef1i-" },
if understand correctly, users profile url looks http://www.linkedin.com/profile/view?id=156996610
should able extract id api call , append view?id=
query right? can simplexml php library?
by xml believe mean json.
one way in php using json_decode()
function.
$url = file_get_contents("http://www.linkedin.com/profile/view?id=156996610");
$json =json_decode($url,true);
the second value "true" means returned associative array.
then can access whatever want response.
i.e user id..
$userid = $json['people']['values']['id'];
i suggest reading json_decode() documentation understand how works.
Comments
Post a Comment