This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Looking Twitter data import solution

Looking Twitter data import solution

Looking Twitter data import solution

Sunday 14 September 2014 3:49:37 am - 3 replies

Hello eZ Community!

I am starting a new project soon which requires a twitter data import solution.

I am already using the sqliimport extension to import data from various sources and types.

I was wondering if anyone had a current (new twitter api not the old deprecated apis) implementation of twitter content import solution?

I'd really like to find someone with a sqliimport handler already written for this need but I am willing to use another solution if someone shares one.

Thank you for your continued support!


Sunday 14 September 2014 4:00:37 am

Example of Twitter API

 $consumerKey = 'YOUR CONSUMER KEY';
        $consumerSecret = 'YOUR CONSUMER SECRET';
        $encodedKey = urlencode($consumerKey);
        $encodedSecret = urlencode($consumerSecret);
        $bearerTokenCredentials = $encodedKey.':'.$encodedSecret;
        // This can probably be stored across multiple sessions
        $_SESSION['base64BearerTokenCredentials'] = $base64BearerTokenCredentials = base64_encode($bearerTokenCredentials);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, '');
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'grant_type=client_credentials');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
        curl_setopt($ch, CURLOPT_HTTPHEADER,
                array('Content-Type: application/x-www-form-urlencoded;charset=UTF-8',
                        'Authorization: Basic '.$base64BearerTokenCredentials));
        $result = curl_exec($ch);
        $error = curl_errno($ch);
        if ($error === 0) {
                $json = json_decode($result);
                curl_setopt($ch, CURLOPT_URL, '');
                curl_setopt($ch, CURLOPT_HTTPGET, true);
                curl_setopt($ch, CURLOPT_POST, false);
                curl_setopt($ch, CURLOPT_HTTPHEADER,
                                array('Authorization: Bearer '.$json->access_token));
                $result = curl_exec($ch);
                $error = curl_errno($ch);
                if ($error === 0) {
                        $_SESSION['access_token'] = $json->access_token;
                        $json = json_decode($result);
                        $countries = array();
                        foreach ($json as $location) {
                                if ($location->placeType->name == 'Country') {
                                        $countries[$location->woeid] = $location->name;
                        $_SESSION['countries'] = $countries;

Sunday 14 September 2014 4:20:50 pm


You could use this ..

Just an idea


Sunday 14 September 2014 8:21:24 pm makes it easier to connect to external webservices than plain curl. It has an example for connecting to twitter via its old API, but it might be helpful even with the new one...


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from