调用WAMP服务器3中未定义的函数curl_init()

问题描述 投票:0回答:2

我已经在Stackoverflow中挖掘了几个小时,但我仍然没有设法解决这个问题:(我想用Curl进行POST请求以获取Auth令牌,但是即使我:-确保未注释掉extension=php_curl.dll-尝试了不同版本的PHP-下载了固定的curl扩展并替换了(https://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/

我的代码:

  function getToken() {
    echo "start gettoken";

    $jsonStr = http_build_query(Array(
        "client_id" => "***",
        "scope" => "https://graph.microsoft.com/.default",
        "client_secret" => "***",
        "grant_type" => "client_credentials"
    ));
    $headers = Array("Content-Type: application/x-www-form-urlencoded");

    $ch = curl_init("https://login.microsoftonline.com/***.onmicrosoft.com/oauth2/v2.0/token");
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonStr);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $token = curl_exec($ch);
    echo "test after curl";
    var_dump($token);
    echo $token;
    return $token;

    curl_error($ch);


}

some1可以帮我一个忙吗?>

我已经在Stackoverflow中挖掘了几个小时,但我仍然没有设法解决这个问题:(我想用Curl进行POST请求以获取Auth令牌,但是即使我:-确保extension = ...

php curl wamp
2个回答
0
投票

启用php_curl.dll扩展名,似乎已被禁用。您可以使用


© www.soinside.com 2019 - 2024. All rights reserved.