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 9161305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:56:19+00:00 2026-06-17T13:56:19+00:00

I am trying to search some images with bing api key. I wrote this

  • 0

I am trying to search some images with bing api key.
I wrote this code but it don’t work, and it not return some error.
I think it is an api error…can you help me?

$accountKey = 's+s/s=';
$rootUri = 'https://api.datamarket.azure.com/Bing/Search';

// Get the query. Default to 'sushi'.
$query = ($_GET['q']) ? $_GET['q'] : 'sushi';

// Get the service operation. Default to Web.
$serviceOp = ($_GET['sop']) ? $_GET['sop'] : 'Web';

// Get the market. Default to en-us.
$market = ($_GET['market']) ? $_GET['market'] : 'en-us';

$ServiceRootURL =  'https://api.datamarket.azure.com/Bing/SearchWeb/';  
$WebSearchURL = $ServiceRootURL . 'Web?$format=json&Query=';

$request = $WebSearchURL . urlencode( '\'' . $query. '\'');
echo $request;
//$requestUri = "$rootUri/$serviceOp?\$format=json&Query=$query&Market=$market";

$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);
$response = curl_exec($process);
$jsonobj = json_decode($response);
echo "<br>Ris = ".$jsonobj;
  • 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-17T13:56:20+00:00Added an answer on June 17, 2026 at 1:56 pm

    I just jump into the documentation and you can use file_get_contents instead of cURL.

    <?php
    $accountKey = 'xxxxx';
    
    $auth = base64_encode("$accountKey:$accountKey");
    
    $data = array(
      'http'            => array(
      'request_fulluri' => true,
      'ignore_errors'   => true,
      'header'          => "Authorization: Basic $auth")
    );
    
    $context   = stream_context_create($data);
    $query     = isset($_GET['q']) ? $_GET['q'] : 'sushi';
    $serviceOp = isset($_GET['sop']) ? $_GET['sop'] : 'Web';
    $market    = isset($_GET['market']) ? $_GET['market'] : 'en-us';
    
    $ServiceRootURL = 'https://api.datamarket.azure.com/Bing/Search/';  
    $WebSearchURL   = $ServiceRootURL . 'Web?$format=json&Query=';
    
    $request = $WebSearchURL . urlencode( '\'' . $query. '\'');
    
    // Get the response from Bing.
    $response = file_get_contents($request, 0, $context);
    var_dump($response);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to find some manual information on this, but my search is
I'm trying to make some beauty search box with css. On chrome, this works
i'm trying to search in Google-images some different and save the first result for
I am trying to cursor search through some records in an access table from
I have some XML which I'm trying to search: <debts> <section id=24 description=YYYYY> <section
I am trying to do a search with some criteria FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(finalQuery,
I have an existing index with some documents I'm trying to search. When I
I am trying to write a bash script(script.sh) to search and replace some variables
I'm currently trying to implement some kind of search system in a program of
I am using search display controller in my code for searching. But it is

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.