Importer/Importer.php
public function requestAccessToken()
    {
        $config = $this->getConfig();

        $token_url = $config['urls']['token'];
        $params = array();
        $params['client_id'] = $config['api_key'];
        $params['redirect_uri'] = $this->getRedirect();
        $params['code'] = $this->getCode();
        $params['grant_type'] = 'authorization_code';
        $params['client_secret'] = $config['secret_key'];

        //get access token
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $token_url);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);  // don't worry about bad ssl certs
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));  // @todo why post a get query?

        $response = curl_exec($ch);

        if (!$response) {
            throw new \Exception('no response from linkedin');
        }

        $response = json_decode($response);
        if (!isset($response->access_token) || !$response->access_token) {
            throw new \Exception('no access token received from linkedin');
        }

        $this->setAccessToken($response->access_token);

        return (string) $response->access_token;
    }
public function requestAccessToken()
    {
        $config = $this->getConfig();

        $token_url = $config['urls']['token'];
        $params = array();
        $params['client_id'] = $config['api_key'];
        $params['redirect_uri'] = $this->getRedirect();
        $params['code'] = $this->getCode();
        $params['grant_type'] = 'authorization_code';
        $params['client_secret'] = $config['secret_key'];

        //get access token
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $token_url);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);  // don't worry about bad ssl certs
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));  // @todo why post a get query?

        $response = curl_exec($ch);

        if (!$response) {
            throw new \Exception('no response from linkedin');
        }

        $response = json_decode($response);
        if (!isset($response->access_token) || !$response->access_token) {
            throw new \Exception('no access token received from linkedin');
        }

        $this->setAccessToken($response->access_token);

        return (string) $response->access_token;
    }
public function requestAccessToken ( ) { $ config = $ this -> getConfig ( ) ; $ token_url = $ config [ 'urls' ] [ 'token' ] ; $ params = array ( ) ; $ params [ 'client_id' ] = $ config [ 'api_key' ] ; $ params [ 'redirect_uri' ] = $ this -> getRedirect ( ) ; $ params [ 'code' ] = $ this -> getCode ( ) ; $ params [ 'grant_type' ] = 'authorization_code' ; $ params [ 'client_secret' ] = $ config [ 'secret_key' ] ; //get access token $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ token_url ) ; curl_setopt ( $ ch , CURLOPT_VERBOSE , 0 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 0 ) ; // don't worry about bad ssl certs curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , http_build_query ( $ params ) ) ; // @todo why post a get query? $ response = curl_exec ( $ ch ) ; if ( ! $ response ) { throw new \ Exception ( 'no response from linkedin' ) ; } $ response = json_decode ( $ response ) ; if ( ! isset ( $ response -> access_token ) || ! $ response -> access_token ) { throw new \ Exception ( 'no access token received from linkedin' ) ; } $ this -> setAccessToken ( $ response -> access_token ) ; return ( string ) $ response -> access_token ; }
Gets access token from linkedin

@throws \Exception
@return string
Gets access token from linkedin