Closed ghost closed 7 years ago
This client only helps you with authentication. That means the client is not opinionated how you query the API. Or in other words: All endpoints/functionality is accessible with the client.
What response do you get when dumping the $results = $linkedIn->get('v1/companies/41732/historical-follow-statistics', $options);
?
Firstly thank you for the super quick response - very kind.
To answer your query I get nothing
I also tried adding some code to test is the variable is empty. But this also doesn't return anything, suggesting the script is stopping before that.
if (empty($results)) { echo "empty"; } else { echo "full"; }
A okey, How about removing the exit()
call? (The one after "Welcome".) That is why the execution stops for you.
Highly embarrassing, thank you. You can see I'm new to PHP
Frustratingly I still dont get the desired response.
I've checked the get function that asks for $resource,$options and I believe all of them are set.
Resource = v1/companies/41732/historical-follow-statistics Options = my array (i've checked the time is correct)
I think maybe its because I'm not passing my token back with the get request?
No you should not care about tokens. Read the error message. "Start time is required". You are using the wrong parameters.
Have a look in the API documentation and consult Linkedin about this error. It is not client related.
Actual Behavior
I was hoping somebody could help with this. I am unable to get the historical follower data from my company account using the api. I am able to connect and authenticate but unable to do anything after that.
Perhaps this functionality is not built into the api client?
Expected Behavior
I am hoping that I can return a json format of historical follower data in the same way as when I use apigee.
Steps to Reproduce
code below: require DIR . '/vendor/autoload.php';
$linkedIn=new Happyr\LinkedIn\LinkedIn('819ehyojqhis4x', 'pskKOktXc9NFuTWi');
if ($linkedIn->isAuthenticated()) { //we know that the user is authenticated now. Start query the API $user=$linkedIn->get('v1/people/~:(firstName,lastName)'); echo "Welcome ".$user['firstName']; exit(); } elseif ($linkedIn->hasError()) { echo "User canceled the login."; exit(); }
//if not authenticated $url = $linkedIn->getLoginUrl(); echo "Login with LinkedIn";
$options = array('json'=> array ('time-granularity' => "day", 'start-timestamp' => 1488326400000, 'format' => "json" )
$results = $linkedIn->get('v1/companies/41732/historical-follow-statistics', $options);
echo $results; var_dump ($results);
Possible Solutions
I have looked through the code and I am unsure of the problem.