0
votes

I've got the following query which pulls a set of results from the Twitter 1.1 API. All the authentication settings work as I have tested this on my local machine and it works as expected (I have removed some superflous code around pagination etc):

#Set API url
$url = 'https://api.twitter.com/1.1/followers/ids.json';

$getfield = '?screen_name='.$screenname.'&count=5000';

#Make request to the API
$requestMethod = 'GET';

$twitter = new TwitterAPIExchange($settings);

#Loop through response and save values
$response=$twitter->setGetfield($getfield)
             ->buildOauth($url, $requestMethod)
             ->performRequest(); 

$data = json_decode($response, true); 

When I deploy this as a Webjob on Azure and run the code it I get a success message in the logs but the data is empty.

[02/04/2015 16:27:46 > 96ed78: SYS INFO] Status changed to Initializing
[02/04/2015 16:27:47 > 96ed78: SYS INFO] Run script 'run.php' with script host - 'PhpScriptHost'
[02/04/2015 16:27:47 > 96ed78: SYS INFO] Status changed to Running ENDS: 16:29
[02/04/2015 16:29:56 > 96ed78: SYS INFO] Status changed to Success

I have looked for information on ports or other settings but can't find anything that relates to this issue.

Is there a setting I need to update in Azure?

1

1 Answers

0
votes

Having done a bit more research I think I may have found an answer. The TwitterAPIExchange library is missing the following line:

 CURLOPT_SSL_VERIFYPEER => false,

Which goes in the following array which occurs on line 192:

$options = array( 
        CURLOPT_HTTPHEADER => $header,
        CURLOPT_HEADER => false,
        CURLOPT_URL => $this->url,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT => 10,
    );