Php 使用Face API时订阅密钥无效

Php 使用Face API时订阅密钥无效,php,azure,face-api,Php,Azure,Face Api,我刚刚创建了一个Face API密钥,并前往Microsoft的测试进行测试,但我得到了无效密钥错误作为响应。我不知道如何将westus更改为westcentralus,所以我编写了一个小PHP代码来发送请求。同样的错误。代码如下: $postData = array( 'url' => '...url to image..', ); // Setup cURL $ch = curl_init('https://westcentralus.api.cognitive.micros

我刚刚创建了一个Face API密钥,并前往Microsoft的测试进行测试,但我得到了无效密钥错误作为响应。我不知道如何将westus更改为westcentralus,所以我编写了一个小PHP代码来发送请求。同样的错误。代码如下:

$postData = array(
    'url' => '...url to image..',
);

// Setup cURL
$ch = curl_init('https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender');
curl_setopt_array($ch, array(
    CURLOPT_POST => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HTTPHEADER => array(
        'Ocp-Apim-Subscription-Key' => '9******************************6',
        'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($postData)
));

// Send the request
$response = curl_exec($ch);

您应该更改以下代码行:

'Ocp-Apim-Subscription-Key' => '9******************************6', 
致:

'Ocp-Apim-Subscription-Key: 9******************************6',