Parsing JSON in PHP using json_decode

73
December 08, 2019, at 09:20 AM

I'm trying to get request from web service which insert my data in Json format. My PHP code which is not succeed is shown below:

    <?php
    $data = file_get_contents("https://siteeee.comm");
    $json = json_decode($data, TRUE);
    $json = array("toppings" => "items","images","item_rating");
    print_r($json['toppings']);
    ?>

This is some of the response that I got. Some of the details has been cut to minimal output, but the object structure is kept as per below:

    {
        "show_disclaimer": false,
        "query_rewrite": {},
        "adjust": {},
        "version": "77d28e2fabc765877f0018dbd9bb8b33",
        "algorithm": "Default|RankServer.HiddentagABTest.oldHiddenTagAlgo,Default|RankServer.Spu.useSpu,Default|RankServer.EmptyAlgo.emptyB,Default|RankServer.Cache",
        "total_count": 255,
        "error": null,
        "total_ads_count": 0,
        "nomore": true,
        "price_adjust": {},
        "json_data": "",
        "suggestion_algorithm": 0,
        "items": [
            {
                "itemid": 5100215745,
                "welcome_package_info": null,
                "liked": false,
                "currency": "IDR",
                "images": [
                    "eaf70e91f293f56b17952d",
                    "0e960e6a4964c977abd706",
                    "d0e96229eefabd24717bab",
                    "99172a69216ee2b1bbfa96",
                    "11bad4c46e01afd9b9a2b7",
                    "dfe31a6f129afeb594f963",
                    "a5420992b9949cf3c29c25",
                    "15126c03f16737cf494b1f",
                    "4ec634fba6e220037e3e49"
                    ],
                    "item_rating": {
                        "rating_star": 5.243442,
                        "rating_count": [
                            2957,
                            50,
                            29,
                            151,
                            433,
                            3365
                        ],
    }
READ ALSO
How to get results of more than one condition at a time

How to get results of more than one condition at a time

I even don't know how to ask my question!

77
PHP: When using javascript in a html file I could assign var mythis=this in the global scope. Is there a similiar way in PHP?

PHP: When using javascript in a html file I could assign var mythis=this in the global scope. Is there a similiar way in PHP?

When using javascript in a html file I could assign var mythis=this in the global scopeIs there a similiar way in PHP?

67
Is there a Phar available for Microsoft Graph?

Is there a Phar available for Microsoft Graph?

I am trying to work with Microsoft Graph APIs using PHP as per https://docsmicrosoft

67
Tests do not run after upgrading from 4.3 to 4.4

Tests do not run after upgrading from 4.3 to 4.4

A project in Symfony 43 has a functional test suite with 43 tests that all pass

59