I'm basing my code on the sample PHP code LinkedIn makes available at https://developer.linkedin.com/documents/code-samples.
The differences between their code and mine are few.
The sample code just requests two profile fields:
$user = fetch('GET', '/v1/people/~:(firstName,lastName)');
I wanted a lot more, so I requested all these profile fields as defined at https://developer.linkedin.com/documents/profile-fields:
$user = fetch('GET', '/v1/people/~:(firstName,lastName,headline,industry,specialties,summary,positions,public-profile-url,email-address,interests,publications,languages,skills,certifications,educations,num-recommenders,date-of-birth,honors-awards)');
The request is successful and profile fields are returned and I can print most of them to display. But the fields which are hyphenated, such as public-profile-url don't seem to be returning usable data. I must be doing something wrong, because it can't be a coincidence that all the hyphenated profile field are empty.
After the successful return I tried using print statements to show the results for each field:
print "<br />headline: $user->headline ";
print "<br />industry: $user->industry ";
print "<br /><br />public-profile-url: " . $user->{'public-profile-url'};
print "<br /><br />email-address: " . $user->{'email-address'};
etc.
This works for all the fields that were simple strings. For some I needed to use print_r because they were objects.
But I don't get any data at all for the hyphenated fields.
If I try print_r:
print_r($user->{'public-profile-url'});
the result is blank.
If I try var_dump:
var_dump($user->{'public-profile-url'});
the result is NULL.
This is the same for all the hyphenated profile fields I tried:
public-profile-url email-address num-recommenders date-of-birth honors-awards
It seems to be too much of a coincidence that just the hyphenated profile fields would all be NULL, so I think I must be doing something else wrong.
Any ideas?
Thanks,
doug
print_r($user)? - AlexV