ok, before I start I am building this in a virtual box running with Ubuntu which does have CURL installed and working!
So reading a number of blog posts and help sites, I used the following code to build pull in my timeline from twitter,
require_once("twitteroauth.php");
$twitteruser = "MY-TWITTER-NAME";
$notweets = 30;
$consumerkey = "XXXX-XXXXXXX";
$consumersecret = "XXXX-XXXXXXX";
$accesstoken = "XXXX-XXXXXXX-XXXX-XXXXXXX";
$accesstokensecret = "XXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXX";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$GetAllMyTweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
This all works, no problems, the problem is when I try to use it within my CakePHP site, I have the current following code used form a blog I found,
App::import('Vendor', 'twitteroauth', array('file' => 'twitteroauth'. DS .'twitteroauth.php')); <- outside the controller call
public function Index() {
$consumerkey = "XXXX-XXXXXXX";
$consumersecret = "XXXX-XXXXXXX";
$accesstoken = "XXXX-XXXXXXX-XXXX-XXXXXXX";
$accesstokensecret = "XXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXX";
$Oauth = new TwitterOAuth ($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$Credentials = $Oauth->get("account / verify_credentials ");
debug($Credentials);
die();
//$this->render('/Pages/Main');
}
However I get the following error,
Error: Call to undefined function curl_init()
File: /var/www/app/Vendor/twitteroauth/twitteroauth.php
Line: 199
Which I don't understand? What I am doing wrong? Or what I am not doing? Or do I have to pull in a helper or something to let CakePHP work with the CURL?
Please help
Glenn.