不能卷曲在wamp工作

时间:2012-10-25 18:48:42

标签: php curl wamp

我是一个完整的PHP / wamp noob,但我只想尝试一些简单的代码。我正在使用一个库帮助我使用OAuth for Twitter,并且已经在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>

我得到的错误消息: 致命错误:在第581行的C:\ wamp \ www \ PHP \ tmhOAuth.php中调用未定义的函数curl_init() tmhOAuth是我正在使用的库文件之一。

快速推出Google之后,我遵循了以下教程: http://www.phpmind.com/blog/2011/02/how-to-enable-curl-in-wamp/ 我在apache和php文件夹中找到了php.ini,并取消了关于curl的行。我还用我发现的另一个教程的指示替换了ext文件夹中的php_curl.dll和不同版本的文件。

请帮忙

2 个答案:

答案 0 :(得分:1)

您是否检查过您的PHP加载了哪个php.ini?制作php文件并将phpinfo()放入其中,运行并检查“已加载的配置文件”

你重启了网络服务器吗?因为php.ini是在你的情况下重新加载webserver重启。

此类使用https协议吗?然后你还需要取消注释openssl扩展名。

答案 1 :(得分:0)

在Windows中测试PHP.INI配置的好处是运行PHP-CLI或检查日志。

您可以打开cmd并运行命令php,查看您的conf发生了什么。

相关问题