How to get facebook friends work_history and company id?
-
29-04-2021 - |
Вопрос
Hi I am using following FQL to fetch friends list from facebook and their details
select uid, name, work_history, education_history, current_location from user where uid IN (select uid2 from friend where uid1=FACEBOOK_USER);
and I get the following result array which fine and correct.
Now my question is it any how possible to get the company id in which friend works. A unique identifier of the company so that I can fetch company specific details using e.g. http://graph.facebook.com/cocacola (an example of getting details of cocacola company/fan-page) ???
Such as friend working in GO-AdventureSports should also have unique identifier in the array.
Array ( [0] => Array ( [uid] => 12312312312 [name] => Raj Singh [work_history] => Array ( [0] => Array ( [company_name] => Intersil )
)
[education_history] => Array
(
)
[current_location] => Array
(
[city] => Santa Clara
[state] => California
[country] => United States
[zip] =>
[id] => 1231231231
[name] => Santa Clara, California
)
)
[1] => Array
(
[uid] => 123123123
[name] => Rana Sidhu
[work_history] => Array
(
[0] => Array
(
[location] => Array
(
[city] =>
[state] =>
)
[company_name] => GO-AdventureSports
[description] =>
[start_date] =>
[end_date] =>
)
)
[education_history] => Array
(
)
[current_location] =>
)
Any ideas are highly appreciated ...
Решение
In the above sql query just add work and it will return company names with their ids. Now if one want work_history can be ignored.
final query
select uid, name, work_history, work, education_history, current_location from user where uid IN (select uid2 from friend where uid1=FACEBOOK_USER);
Hope it help some one.
-deepak
Другие советы
Try this query:
select uid, name,work, work_history, education_history, current_location from user where uid IN (select uid2 from friend where uid1=FACEBOOK_USER);
work gives company name with it's id on facebook and work_history doesn't give id's only give plain information.
See following output:
[work] => Array
(
[0] => Array
(
[employer] => Array
(
[id] => 105551752814478
[name] => Fujitsu Consulting India Ltd
)
[location] => Array
(
[id] => 106442706060302
[name] => Pune, Maharashtra
)
[position] => Array
(
[id] => 139966739368093
[name] => IT Consultant
)
[start_date] => 2009-10
[end_date] => 0000-00
)
[1] => Array
(
[employer] => Array
(
[id] => 109256905760858
[name] => Fujitsu
)
)
)
[work_history] => Array
(
[0] => Array
(
[location] => Array
(
[city] => Pune
[state] => Maharashtra
)
[company_name] => Fujitsu Consulting India Ltd
[position] => IT Consultant
[description] =>
[start_date] => 2009-10
[end_date] => 0000-00
)
[1] => Array
(
[location] => Array
(
[city] =>
[state] =>
)
[company_name] => Fujitsu
[description] =>
[start_date] =>
[end_date] =>
)
)