Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:41:53+00:00 2026-06-09T03:41:53+00:00

I have been porting an application at work from the old Bing API to

  • 0

I have been porting an application at work from the old Bing API to the new one. Having seen several posts about how the new one works in PHP I’m getting Authentication issues with it.

This is the error that is returned by the URL:

Warning: file_get_contents(https://api.datamarket.azure.com/Bing/Search/Image?$format=json&Query=%27%27) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 The authorization type you provided is not supported. Only Basic and OAuth are supported in /home/krem81/public_html/classes/class.BingSearch.php on line 178

And in turn, this is the function that I am using to interact with the API:

$accountKey = $this->Appid;

$ServiceRootURL =  "https://api.datamarket.azure.com/Bing/Search/";

$WebSearchURL = $ServiceRootURL . 'Image?$format=json&Query=';

$context = stream_context_create(array(
    'http' => array(
        'request_fulluri' => true,
        'header'  => "Authorization: Basic " . base64_encode($accountKey . ":" . $accountKey)
    )
));

$request = $WebSearchURL . urlencode( '\'' . $_POST["searchText"] . '\'');

echo($request);

$this->response = file_get_contents($request, 0, $context);

$this->results = json_decode($this->response);

Since trying this I have also now tried

    $accountKey = $this->Appid;

    $ServiceRootURL =  "https://api.datamarket.azure.com/Bing/Search/";

    $WebSearchURL = $ServiceRootURL . 'Image?$format=json&Query=';

    $request = $WebSearchURL . urlencode( '\'' . $this->keyword . '\'');

    echo($request);

    $process = curl_init($request);
    curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($process, CURLOPT_USERPWD,  $accountKey . ":" . $accountKey);
    curl_setopt($process, CURLOPT_TIMEOUT, 30);
    curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);

    $this->response = curl_exec($process);

    var_dump($this->response);

    $this->results = json_decode($this->response);

    var_dump($this->results);

Does anyone have any ideas as to what could be triggering the authentication to fail?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:41:55+00:00Added an answer on June 9, 2026 at 3:41 am

    Another team member changed the name of a variable that I guess I really should have checked straight away. $this->Appid should have been $this->APPID.

    As I said to ManseUK in the comments though Microsoft could provide a better error message for the missing app id though, something along the lines of ‘invalid appid’ to help narrow the issue down

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been tasked with porting/refactoring a Web Application Platform that we have from ASP.NET
In general, I have been having difficulties porting my .NET Windows Forms applications created
I have been given the task of porting an Access application to Eclipse RCP/RAP.
I have been recently porting a Perl application form Oracle to Postgres (my first
I am new to OS X and have to create an application having 2
I have been porting oracle selects, and I have been running across a lot
I have been tasked with porting a large Java codebase to the Android platform.
I have been reading up on porting ASP.NET Membership Provider into .NET 3.5 using
I have been tasked with creating an API for retrieving and adding content to
I am in the process of porting an application from x86 to x64. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.