Importer/Importer.php
public function requestUserData($type = 'private', $access_token = null)
    {
        $config = $this->getConfig();
        $access_token = ($access_token) ? $access_token : $this->getAccessToken();
        $url = null;

        switch ($type) {
            case 'public':
                //error if no profile set
                if (!$this->getPublicProfileUrl()) {
                    throw new \Exception('please set the public profile you want to pull');
                }

                $url = $config['urls']['public']
                    . urlencode(urldecode($this->getPublicProfileUrl()))  // make sure the url is encoded; avoid double encoding
                    . $config['dataset'][$type]['fields'];
                break;
            case 'private':
            case 'login':
            default:
                $url = $config['urls']['private']
                    . $config['dataset'][$type]['fields'];
                break;
        }

        //add access token to request url
        $url .= '?' . http_build_query(array('oauth2_access_token' => $access_token, 'secure-urls' => 'true'));

        //send it
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $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_HTTPHEADER, array("Accept-Language: en-US, ja"));
        $response = curl_exec($ch);

        $data = simplexml_load_string($response);

        return $data;
    }
public function requestUserData($type = 'private', $access_token = null)
    {
        $config = $this->getConfig();
        $access_token = ($access_token) ? $access_token : $this->getAccessToken();
        $url = null;

        switch ($type) {
            case 'public':
                //error if no profile set
                if (!$this->getPublicProfileUrl()) {
                    throw new \Exception('please set the public profile you want to pull');
                }

                $url = $config['urls']['public']
                    . urlencode(urldecode($this->getPublicProfileUrl()))  // make sure the url is encoded; avoid double encoding
                    . $config['dataset'][$type]['fields'];
                break;
            case 'private':
            case 'login':
            default:
                $url = $config['urls']['private']
                    . $config['dataset'][$type]['fields'];
                break;
        }

        //add access token to request url
        $url .= '?' . http_build_query(array('oauth2_access_token' => $access_token, 'secure-urls' => 'true'));

        //send it
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $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_HTTPHEADER, array("Accept-Language: en-US, ja"));
        $response = curl_exec($ch);

        $data = simplexml_load_string($response);

        return $data;
    }
public function requestUserData ( $ type = 'private' , $ access_token = null ) { $ config = $ this -> getConfig ( ) ; $ access_token = ( $ access_token ) ? $ access_token : $ this -> getAccessToken ( ) ; $ url = null ; switch ( $ type ) { case 'public' : //error if no profile set if ( ! $ this -> getPublicProfileUrl ( ) ) { throw new \ Exception ( 'please set the public profile you want to pull' ) ; } $ url = $ config [ 'urls' ] [ 'public' ] . urlencode ( urldecode ( $ this -> getPublicProfileUrl ( ) ) ) // make sure the url is encoded; avoid double encoding . $ config [ 'dataset' ] [ $ type ] [ 'fields' ] ; break ; case 'private' : case 'login' : default : $ url = $ config [ 'urls' ] [ 'private' ] . $ config [ 'dataset' ] [ $ type ] [ 'fields' ] ; break ; } //add access token to request url $ url .= '?' . http_build_query ( array ( 'oauth2_access_token' => $ access_token , 'secure-urls' => 'true' ) ) ; //send it $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ 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_HTTPHEADER , array ( "Accept-Language: en-US, ja" ) ) ; $ response = curl_exec ( $ ch ) ; $ data = simplexml_load_string ( $ response ) ; return $ data ; }
Gets user data from linkedin.


@param  string            $type
@param  string            $access_token
@throws \Exception
@return \SimpleXMLElement
Gets user data from linkedin .