我在 stackoverflow 和其他地方都看到了很多这样的东西——尽我所能,我仍然会收到这个错误。
任何方式 - 有用的信息
我试图执行的代码如下
<?php
function getOAuthToken ( $grantCode, $grant_type ) {
global $client_id;
global $client_secret;
global $refresh_token;
try {
ini_set('display_errors', '1');
error_reporting(E_ALL);
$oauth2token_uri = "https://accounts.google.com/o/oauth2/token";
$clienttoken_post = array(
"client_id" => $client_id,
"client_secret" => $client_secret
);
if ($grant_type === "online") {
$clienttoken_post["code"] = $grantCode;
$clienttoken_post["redirect_uri"] = $refresh_token;
$clienttoken_post["grant_type"] = "authorization_code";
}
if ($grant_type == "offline") {
$clienttoken_post["refresh_token"] = $grantCode;
$clienttoken_post["grant_type"] = "refresh_token";
}
$curl = cur_init($oauth2token_uri);
}
catch ( Exception $e )
{
echo 'Message: ' .$e->getMessage();
}
};
session_start();
if (isset($_GET['code'])) {
try
{
$accessToken = getOAuthToken($_GET['code'],'online');
}
catch (Exception $e)
{
echo 'Message: ' .$e->getMessage();
}
}
?>
Windows 7(64 位)IIS Express
PHP.INI
执行 phpInfo() 会提供以下信息。
PHP 版本 5.3.24
加载的配置文件 C:\Program Files (x86)\php\php.ini
启用 cURL 支持 cURL 信息 7.29.0 Age 3 功能 AsynchDNS 是 Debug 否 GSS-Negotiate 是 IDN 否 IPv6 是 Largefile 是 NTLM 是 SPNEGO 是 SSL 是 SSPI 是 krb4 否 libz 是 CharConv 否 协议 dict、file、ftp、ftps、gopher、 http、https、imap、imaps、ldap、pop3、pop3s、rtsp、scp、sftp、smtp、smtps、telnet、tftp 主机 i386-pc-win32 SSL 版本 OpenSSL/0.9.8y ZLib 版本 1.2.7 libSSH 版本 libssh2/1.4 .2
执行以下代码;
<?php
$ci=@curl_version(); $cv=$ci["version_number"]; if($cv) echo "curl
installed"; else echo "curl is not installed";
?>
显示 curl 已安装
Libcurl.dll (v7.13) 安装在 Windows\System32 C:\Windows\SysWOW64
扩展目录为 C:\Program Files (x86)\php\v5.3\ext
这包含 php_curl.dll (ver 5.3.24)
在 php.ini 文件中的行
extension=php_curl.dll
前面没有分号
DLL ssleay32.dll(版本 0.9.8y)已复制到 c:\windows\System32 和 C:\Windows\SysWOW64
DLL libeay32.dll (ver 1.0.1e) 已复制到 c:\windows\System32 和 c:\windows\sysWOW64
我认为这涵盖了我能够找到的所有答案,但仍然出现“调用未定义函数 cur_init()”错误并且不知道接下来要尝试什么。