'text' => 'OAuth 2 flow, composer Package.' 'text' => 'Checkout this amazing PHP SDK for LinkedIn!' Make sure that image URL is available from the Internet (don't use localhost in the image url). Print_r( $profile) Share content on a personal profile Print_r( $profile) List companies where you are an admin $profile = $client-> get( delete $client-> delete( 'ENDPOINT') Examples Perform api call to get profile information $profile = $client-> get( There are 3 helper methods: // get method $client-> get( 'ENDPOINT', ) set token for client $client-> setAccessToken( $accessToken) Performing API callsĪll API calls can be called through simple method: $profile = $client-> api( instantiate access token object from stored data $accessToken = new AccessToken( $tokenData, $tokenData) $tokenData = json_decode( $tokenString, true) load token from the file $tokenString = file_get_contents( 'token.json') Instance of LinkedIn\AccessToken to this method. You can use method setAccessToken() for the LinkedIn\Client class to set token stored as string. Please, ensure that tokens are stored securely. This way of storing tokens is not recommended due to security concerns and used for demonstration purpose. You can store this token in the file like this: file_put_contents( 'token.json', json_encode( $accessToken)) This method returns object of LinkedIn\AccessToken class. To get access token use (don't forget to set redirect url) $accessToken = $client-> getAccessToken( $ _GET) You can use link or rely on Location HTTP header. $loginUrl = $client-> getLoginUrl( $scopes) // get url on LinkedIn to start linking To get redirect url to LinkedIn, use the following approach: use LinkedIn\ Scope In order of performing OAUTH 2.0 flow, you should get LinkedIn login URL.ĭuring this procedure you have to define scope of requested permissions. Set a custom redirect url use: $client-> setRedirectUrl( '') Getting LinkedIn redirect URL We recommend you to have it stored during the linking sessionīecause you will need to use it when you will be getting access token. SDK provides you a getRedirectUrl() helper for your convenience: $redirectUrl = $client-> getRedirectUrl() To start linking process you have to setup redirect url. instantiate the Linkedin client $client = new Client( import client class use LinkedIn\ Client please, add composer autoloader first include_once _DIR_. Bootstrapping autoloader and instantiating a client //. Save ClientId and ClientSecret, you will use them later. To start working with LinkedIn API, you will need toĪnd create new application in section My Apps. This will save you a lot of time and prevent some silly questions. If you have never used Composer, you should start hereīefore you will get started, play visit to LinkedIn API Documentation. Or add this package as dependency to composer.json. Use composer package manager to install the lastest version of the package: composer require zoonman/linkedin-api-php-client We match officially supported versions of PHP. Visit our blog for a bunch of other useful–and cool–things you can do with Amigo Data, such as pulling data from SurveyMonkey to Google Sheets, tracking stock markets and cryptocurrencies with Google Sheets, and importing Google Ads data to Google Sheets.See complete example inside index.php to get started. Learn more about Setting Refresh Schedule And Alert In Amigo Data. You can set a refresh schedule and Amigo Data will update the data at regular intervals automatically. If you need to constantly keep watch on a profile–not that you may ever need to, and it may be tantamount to stalking but if you want to–there’s an option. In the Value field is where we enter the LinkedIn profile URL of the profile we want to scrape. Then click the “ +QUERY” button and add the required parameter. So enter the headers used above in the headers field. The headers are the same for all queries. However, instead of repeatedly entering the profile URL in RapidAPI and copy-pasting the API endpoint URL, which can be tedious if we need to scrape data from LinkedIn for several profiles, we can use the same base endpoint URL and the headers and specify the query parameters (the profile URL) separately.Įnter the base endpoint URL given below in the API URL field. We can likewise scrape the profile data of any LinkedIn user.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |