我是一个完整的PHP/wamp noob,但我只是想让一小段代码工作。我正在使用一个库来帮助我使用Twitter的OAuth,并且一直在用Windows上的wamp编写和测试我的代码。卷曲不能在卷曲中工作
这是我的代码:
<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>
和错误消息我得到: 致命错误:调用在C未定义功能curl_init():\ WAMP \ WWW \ PHP \ tmhOAuth.php上线581 tmhOAuth是我正在使用的库文件之一。
快速谷歌之后,我跟着这个教程: http://www.phpmind.com/blog/2011/02/how-to-enable-curl-in-wamp/ 我发现的php.ini中均Apache和PHP文件夹,并注释掉有关卷曲的线条。我还用ext文件夹中的php_curl.dll替换了另一个教程中指示的另一个教程。
请帮
重新检查一切:您的PHP扩展路径是否正确定义?你试过重新启动WAMP吗?您是否尝试过这里描述的步骤:http://www.technoreaders.com/2009/07/26/curl-on-wamp/? – akluth
你可以在你的网络服务器上创建一个文件来显示phpinfo吗? '<?php phpinfo(); ?>'。搜索卷曲以查看它是否存在并在phpinfo显示中启用。如果不是,卷曲模块未启用 –
看来cURL扩展没有正确安装。你可以通过phpinfo()验证正确的安装 –