Hi can someone help me.
I have a PHP script that is using a very common twitter / oAuth class to authenticate me before making a request and its been changed to https://api.twitter.com/1.1/ so should in theory work.
A lot of Wordpress Twitter plugins use this Twitter/oAuth class and I just changed the line 29
/* Set up the API root URL. */
public $host = "https://api.twitter.com/1.1/";
This solved my issue with my own Twitter Wordpress plugins but with my scripts that are run by CRON jobs it doesnât seem to work.
I have a script that is basically trying to get a list of my followers (a simple Direct Message - hello BOT) and then send out a tweet to the new people.
However even though oAuth is saying I am authenticated and connected with my consumer and access keys/secrets I cannot get back a list of my followers and keep getting a response like this.
{âerrorsâ:[{âmessageâ:âBad Authentication dataâ,âcodeâ:215}]}
The URL I am trying to use is (a cut down) > https://api.twitter.com/1.1/followers/list.json?screen_name=darkpoltweeter
So even though the oAuth class is saying I am authenticated ( and yes I have an application setup for doing this and I have checked the consumer/access keys/secrets ) I cannot get a JSON response back.
Even if I just login to Twitter with my logon and try to access that URL I get the same response.
My debug is the following
load twitter
load oauth
init class
OAuthToken loaded
loaded twitter class
connect with access token = BLAH-BLAH and secret = BLAHBLAHBLAH
VERIFY ACCOUNT WITH OAUTH
Connected as @darkpoltweeter
check for new followers
got a response from https://api.twitter.com/1.1/followers/list.json?screen_name=darkpoltweeter
body = {âerrorsâ:[{âmessageâ:âBad Authentication dataâ,âcodeâ:215}]}
I have tried using a simple file_get_contents, CURL, fsock etc and at the moment I am using the inbuilt TwitterOAuth method http e.g
$followers_url = "https://api.twitter.com/1.1/followers/list.json?screen_name=darkpoltweeter";
$response = $oauth->http($followers_url,"GET");
However nothing seems to work. From the documentation this URL should be giving me the right list of followers if I am authenticated (which the oAuth class is telling me I am) so I donât know what I need to be doing that Iâm not at the moment.
Any help would be much appreciated.