I'm a complete PHP/wamp noob but am just trying to get a simple bit of code to work. I'm using a library to help me out with OAuth for Twitter, and have been writing and testing my code with wamp on Windows.
This is my code:
<html>
<body>
<?php
include 'tmhOAuth.php';
include 'tmhUtilities.php';
$tweet_text = 'Test Tweet. If you can see this, my PHP code is working! Yay';
echo "Posting...\n";
$result = post_tweet($tweet_text);
echo "Response code: " . $result . "\n";
function post_tweet($tweet_text) {
$connection = new tmhOAuth(array(
'consumer_key' => 'xxxxxxxxxx',
'consumer_secret' => 'xxxxxxxxxxxx',
'user_token' => 'xxxxxxxxxxxxxxxxx',
'user_secret' => 'xxxxxxxxxxxxxx',
));
$connection->request('POST',
$connection->url('1/statuses/update'),
array('status' => $tweet_text));
return $connection->response['code'];
}
?>
</body>
</html>
And the error message I get: Fatal error: Call to undefined function curl_init() in C:\wamp\www\PHP\tmhOAuth.php on line 581 tmhOAuth is one of the library files I'm using.
After a quick Google, I followed this tutorial: http://www.phpmind.com/blog/2011/02/how-to-enable-curl-in-wamp/ I found php.ini in both the apache and php folders, and uncommented the lines about curl. I also replaced php_curl.dll in the ext folder with a different version of the file as instructed by another tutorial I found.
Please help