Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 身份验证失败。提供的凭据无效或帐户处于非活动状态_Php_Authentication_Bing Ads Api - Fatal编程技术网

Php 身份验证失败。提供的凭据无效或帐户处于非活动状态

Php 身份验证失败。提供的凭据无效或帐户处于非活动状态,php,authentication,bing-ads-api,Php,Authentication,Bing Ads Api,我试图在Bing Ads Api上进行身份验证,但收到以下消息: 身份验证失败。提供的凭据无效或帐户处于非活动状态 这是我的代码: $UserName = "xxx@hotmail.com"; $Password = "xxx"; $DeveloperToken = "xxx"; $CustomerId = xxx; $AccountId = xxx; $wsdl = "https://campaign.api.bingads.microsoft.com/Api/Advertiser/Camp

我试图在Bing Ads Api上进行身份验证,但收到以下消息:

身份验证失败。提供的凭据无效或帐户处于非活动状态

这是我的代码:

$UserName = "xxx@hotmail.com";
$Password = "xxx";
$DeveloperToken = "xxx";
$CustomerId = xxx;
$AccountId = xxx;

$wsdl = "https://campaign.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V10/CampaignManagementService.svc?singleWsdl";
try
{
    $proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, $CustomerId, null);

    // Specify one or more campaigns.

    $campaigns = array();

    $campaign = new Campaign();
    $campaign->Name = "Winter Clothing " . $_SERVER['REQUEST_TIME'];
    $campaign->Description = "Winter clothing line.";
    $campaign->BudgetType = BudgetLimitType::MonthlyBudgetSpendUntilDepleted;
    $campaign->MonthlyBudget = 1000.00;
    $campaign->TimeZone = "PacificTimeUSCanadaTijuana";
    $campaign->DaylightSaving = true;
    // Used with FinalUrls shown in the ads that we will add below.
    $campaign->TrackingUrlTemplate = 
       "http://tracker.example.com/?season={_season}&promocode={_promocode}&u={lpurl}";
    $campaigns[] = $campaign;
    // Add the campaign, ad group, keywords, and ads

    $campaignIds = AddCampaigns($proxy, $AccountId, $campaigns);
    PrintCampaignIdentifiers($campaignIds);

}
catch (SoapFault $e)
{
    // Output the last request/response.

    print "\nLast SOAP request/response:\n";
    print $proxy->GetWsdl() . "\n";
    print $proxy->GetService()->__getLastRequest()."\n";
    print $proxy->GetService()->__getLastResponse()."\n";

    // Campaign Management service operations can throw AdApiFaultDetail.
    if (isset($e->detail->AdApiFaultDetail))
    {
        // Log this fault.

        print "The operation failed with the following faults:\n";

        $errors = is_array($e->detail->AdApiFaultDetail->Errors->AdApiError)
        ? $e->detail->AdApiFaultDetail->Errors->AdApiError
        : array('AdApiError' => $e->detail->AdApiFaultDetail->Errors->AdApiError);

        // If the AdApiError array is not null, the following are examples of error codes that may be found.
        foreach ($errors as $error)
        {
            print "AdApiError\n";
            printf("Code: %d\nError Code: %s\nMessage: %s\n", $error->Code, $error->ErrorCode, $error->Message);

            switch ($error->Code)
            {
                case 105:  // InvalidCredentials
                    break;
                case 117:  // CallRateExceeded
                    break;
                default:
                    print "Please see MSDN documentation for more details about the error code output above.\n";
                    break;
            }
        }

很抱歉延迟回复。我注意到您正在将用户名设置为***@hotmail.com。如果您使用的是电子邮件地址登录,即Microsoft帐户,则必须使用OAuth,即设置AuthenticationToken头元素,而不是设置用户名/密码字段