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

  • Home
  • SEARCH
  • 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 8609137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:48:14+00:00 2026-06-12T03:48:14+00:00

First of all, I am extremely new to PHP, so I am still trying.

  • 0

First of all, I am extremely new to PHP, so I am still trying. My issue is: I am trying to echo Bing API results in PHP.

Here is a JSON result example, which I get from

$jsonobj = json_decode($response);

(The response is what I get from Bing, so I just pasted the response below – Just adding this info in case you wonder where I get the $jsonobj = json_decode($response); from)

{"d":{"results":[{"__metadata":{"uri":"https://api.datamarket.azure.com/Data.ashx/Bing/Search/Composite?Sources=\u0027web\u0027&Market=\u0027en-US\u0027&Query=\u0027php\u0027&Adult=\u0027off\u0027&$skip=0&$top=1","type":"ExpandableSearchResult"},"ID":"1c509d25-5ca4-4db5-bfc5-cafd6917e2c2","WebTotal":"10600000","WebOffset":"0","ImageTotal":"","ImageOffset":"","VideoTotal":"","VideoOffset":"","NewsTotal":"","NewsOffset":"","SpellingSuggestionsTotal":"","AlteredQuery":"","AlterationOverrideQuery":"","Web":[{"__metadata":{"uri":"https://api.datamarket.azure.com/Data.ashx/Bing/Search/ExpandableSearchResultSet(guid\u00271c509d25-5ca4-4db5-bfc5-cafd6917e2c2\u0027)/Web?$skip=0&$top=1","type":"WebResult"},"ID":"4cf2a8d6-21b7-433d-81e9-84e74091a44a","Title":"PHP: Hypertext Preprocessor","Description":"What is PHP? PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.","DisplayUrl":"www.php.net","Url":"http://www.php.net/"},{"__metadata":{"uri":"https://api.datamarket.azure.com/Data.ashx/Bing/Search/ExpandableSearchResultSet(guid\u00271c509d25-5ca4-4db5-bfc5-cafd6917e2c2\u0027)/Web?$skip=48&$top=1","type":"WebResult"},"ID":"2d8f8107-895e-4052-9edc-b656e74c3f2e","Title":"CakePHP: the rapid development php framework. Pages","Description":"Official website. Offers a manual for beginners and links towards the last version.","DisplayUrl":"cakephp.org","Url":"http://cakephp.org/"},{"__metadata":{"uri":"https://api.datamarket.azure.com/Data.ashx/Bing/Search/ExpandableSearchResultSet(guid\u00271c509d25-5ca4-4db5-bfc5-cafd6917e2c2\u0027)/Web?$skip=49&$top=1","type":"WebResult"},"ID":"816d781c-ff8b-4a60-b5b7-28d807bba28a","Title":"PHP Presents","Description":"Welcome to the PHP Presentation System. Here we list all of the available presentation categories stored within this system.","DisplayUrl":"talks.php.net","Url":"http://talks.php.net/"}],"Image":[],"Video":[],"News":[],"RelatedSearch":[],"SpellingSuggestions":[]}]}}

Now, I understand that I can echo, for example, the WebTotal by using:

foreach($jsonobj->d->results as $value) {
    echo $value->WebTotal;
}

However, I am lost on how to echo the actual results like the Title, Description and Url.

I tried:

foreach($jsonobj->d->results as $value) {
    echo $value->Title."<br>";
    echo $value->Description."<br>";
    echo $value->Url."<br>";
}

and also something like:

foreach($jsonobj->d->results->Web as $value) {
    echo $value->Title."<br>";
    echo $value->Description."<br>";
    echo $value->Url."<br>";
}

because I thought adding the Web to the foreach will maybe echo the right values, but no success.

Maybe someone could help me and tell me what I am doing wrong?

My mission would be to have the following results:

Title: PHP: Hypertext Preprocessor

Description: What is PHP? PHP is a widely-used general-purpose
scripting language that is especially suited for Web development and
can be embedded into HTML.

URL:http://www.php.net/

Then, the other two results.

Thank you so much 🙂

  • 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-12T03:48:16+00:00Added an answer on June 12, 2026 at 3:48 am

    You can do this as follows:

    foreach($jsonobj->d->results as $result) {
        foreach($result->Web as $value) {
            echo $value->Title;
            // and the same for the other properties
        }
    }
    

    By the way: you should use a tool for formatting your json string. This way it will get much clearer how the json data looks like.

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

Sidebar

Related Questions

I have an extremely weird issue. First of all, when I zoom in and
I'm extremely new to Makefiles, and I'm currently trying to build my first one
hey, first thanks to all for answering my other questions. I am extremely new
I'm extremely new to PHP and my first project was developing a comment system.
First of all, I'm quite new to the Android and JAVA world (coming from
First of all I've gone through dozens of posting here on SO and google
First of all, I am new to R (I started yesterday). I have two
I am currently writing my first program on C# and I am extremely new
first post here ever so forgive me if I am totally ignorant of all
This is my first question here on StackOverflow, and quite frankly I'm fairly new

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.