0

I'm using the twitter API v1.1 and I'm trying to make a simple query on twitter (the list of followers of a user). I've searched a lot on internet and I found many answers to this problem but I don't know what is my mistake. I've look this thread on stack overflow Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

and this is the code I wrote on my php file and upload it on Altervista. Of course on Altervista I have my TwitterAPIExchange.php file and the twitteroauth directory set properly. I try to run it but I got this message: {"errors":[{"code":215,"message":"Bad Authentication data."}]}

<?php
require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
   $consumer_key = "*****",
$consumer_secret = "*****",
$access_token = "*****",
$access_token_secret = "*****"
);

$url = 'https://api.twitter.com/1.1/followers/list.json';
$getfield = '?username=J7mbo&skip_status=1';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest();  

?>
Alex Howansky
  • 50,515
  • 8
  • 78
  • 98

0 Answers0