Otra ayuda con JSON

kazaf Seguir

Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Desde
20 Abr 2009
Mensajes
187
Hola comunidad nuevamente aqui con una duda espero me puedan ayudar.

Pues lo unico que me da bien cuando me da el resultado es el error de offline pero cuando esta en online me da respuesta.

¿Estare haciendo algo mal?

Espero su ayuda bendiciones.

PHP:
i<?php
require_once './lib/Unirest.php';

$username = $_GET['user']; 

$key = '';

$url = 'https://localhost/player/lan/' . $username . '/ingame';
$json = Unirest::get($url, array("X-Mashape-Authorization" => "$key"));

$json = $json->raw_body; 

$jd = json_decode($json);

print_r($json);


if ($json->raw_body == true) {
   $jd = $json->player;
   echo sprintf($jd->image);
}
else {
   echo sprintf($jd->error_message);
}

?>

Online

Insertar CODE, HTML o PHP:
{
    "_": {
        "APP_ID": "server_tracked"
    },
    "success": true,
    "requestTime": "2013-08-28T11:29:17-07:00",
    "shard": "Latin_America_North:NzgwMmE2MGMzYmI2ZWQ5YTRiMWUzNWI3NmVmOTBhMzE2OTUxMmI4ZA",
    "player": {
        "accountId": 200066970,
        "summonerId": 83642,
        "name": "Violency",
        "icon": 560,
        "internalName": "violency",
        "level": 30
    },
    "data": {
        "gameSpecificLoyaltyRewards": null,
        "reconnectDelay": 0,
        "dataVersion": 0,
        "libteemo": "1.0",
        "lastModifiedDate": null,
        "game": {
            "passwordSet": false,
            "spectatorsAllowed": "NONE",
            "gameType": "RANKED_GAME",
            "gameTypeConfigId": 2,
            "gameState": "IN_PROGRESS",
            "glmGameId": null,
            "glmHost": null,
            "observers": {
                "array": [

                ]
            },
            "statusOfParticipants": "1111111111",
            "glmSecurePort": 0,
            "ownerSummary": null,
            "id": 13625911,
            "teamTwo": {
                "array": [
                    {
                        "timeAddedToQueue": 1377712699520,
                        "index": 0,
                        "accountId": 200000940,
                        "queueRating": 0,
                        "originalAccountNumber": 40533379,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "leorik25",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 548,
                        "teamOwner": true,
                        "futureData": null,
                        "summonerId": 20598,
                        "badges": 0,
                        "pickTurn": 2,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "leorik25",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": 86348464
                    },
                    {
                        "timeAddedToQueue": 1377712737967,
                        "index": 0,
                        "accountId": 200008123,
                        "queueRating": 0,
                        "originalAccountNumber": 49180385,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "cr0w112",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 547,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 24133,
                        "badges": 0,
                        "pickTurn": 2,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "Cr0w112",
                        "pickMode": 0,
                        "originalPlatformId": "NA1",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    },
                    {
                        "timeAddedToQueue": 1377712668362,
                        "index": 0,
                        "accountId": 200002167,
                        "queueRating": 0,
                        "originalAccountNumber": 33028280,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "velcroso",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 1,
                        "profileIconId": 563,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 21324,
                        "badges": 0,
                        "pickTurn": 4,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "Velcroso",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    },
                    {
                        "timeAddedToQueue": 1377712699520,
                        "index": 0,
                        "accountId": 200000943,
                        "queueRating": 0,
                        "originalAccountNumber": 39451545,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "juandice",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 561,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 20610,
                        "badges": 0,
                        "pickTurn": 4,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "Juandice",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": 86348464
                    },
                    {
                        "timeAddedToQueue": 1377712742047,
                        "index": 0,
                        "accountId": 200631734,
                        "queueRating": 0,
                        "originalAccountNumber": 50095053,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "ramirotheking",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 558,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 528620,
                        "badges": 0,
                        "pickTurn": 6,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "RamiroTheKing",
                        "pickMode": 0,
                        "originalPlatformId": "NA1",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    }
                ]
            },
            "bannedChampions": {
                "array": [
                    {
                        "dataVersion": 0,
                        "pickTurn": 1,
                        "championId": 98,
                        "teamId": 100,
                        "futureData": null
                    },
                    {
                        "dataVersion": 0,
                        "pickTurn": 2,
                        "championId": 120,
                        "teamId": 200,
                        "futureData": null
                    },
                    {
                        "dataVersion": 0,
                        "pickTurn": 3,
                        "championId": 111,
                        "teamId": 100,
                        "futureData": null
                    },
                    {
                        "dataVersion": 0,
                        "pickTurn": 4,
                        "championId": 67,
                        "teamId": 200,
                        "futureData": null
                    },
                    {
                        "dataVersion": 0,
                        "pickTurn": 5,
                        "championId": 412,
                        "teamId": 100,
                        "futureData": null
                    },
                    {
                        "dataVersion": 0,
                        "pickTurn": 6,
                        "championId": 53,
                        "teamId": 200,
                        "futureData": null
                    }
                ]
            },
            "dataVersion": 0,
            "roomName": null,
            "name": "Match-13625911",
            "spectatorDelay": 0,
            "teamOne": {
                "array": [
                    {
                        "timeAddedToQueue": 1377712594113,
                        "index": 0,
                        "accountId": 200051859,
                        "queueRating": 0,
                        "originalAccountNumber": 32175156,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "b3licus",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 5,
                        "profileIconId": 19,
                        "teamOwner": true,
                        "futureData": null,
                        "summonerId": 76097,
                        "badges": 0,
                        "pickTurn": 1,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "b3licus",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": 86348077
                    },
                    {
                        "timeAddedToQueue": 1377712763470,
                        "index": 0,
                        "accountId": 200016897,
                        "queueRating": 0,
                        "originalAccountNumber": 30459703,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "cachamalol",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 508,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 28690,
                        "badges": 0,
                        "pickTurn": 3,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "cachamalol",
                        "pickMode": 0,
                        "originalPlatformId": "EUW1",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    },
                    {
                        "timeAddedToQueue": 1377712771804,
                        "index": 0,
                        "accountId": 200012637,
                        "queueRating": 0,
                        "originalAccountNumber": 38482073,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "miguel",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 0,
                        "profileIconId": 558,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 36419,
                        "badges": 0,
                        "pickTurn": 3,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "Miguel",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    },
                    {
                        "timeAddedToQueue": 1377712713004,
                        "index": 0,
                        "accountId": 200085935,
                        "queueRating": 0,
                        "originalAccountNumber": 39860499,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "hello244",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 7,
                        "profileIconId": 14,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 103347,
                        "badges": 0,
                        "pickTurn": 5,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "HELLO244",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": null
                    },
                    {
                        "timeAddedToQueue": 1377712594113,
                        "index": 0,
                        "accountId": 200066970,
                        "queueRating": 0,
                        "originalAccountNumber": 37914910,
                        "botDifficulty": "NONE",
                        "summonerInternalName": "violency",
                        "minor": false,
                        "locale": null,
                        "partnerId": "",
                        "lastSelectedSkinIndex": 4,
                        "profileIconId": 560,
                        "teamOwner": false,
                        "futureData": null,
                        "summonerId": 83642,
                        "badges": 0,
                        "pickTurn": 5,
                        "dataVersion": 1,
                        "clientInSynch": true,
                        "selectedRole": null,
                        "summonerName": "Violency",
                        "pickMode": 0,
                        "originalPlatformId": "NA",
                        "selectedPosition": null,
                        "teamParticipantId": 86348077
                    }
                ]
            },
            "terminatedCondition": "NOT_TERMINATED",
            "queueTypeName": "RANKED_SOLO_5x5",
            "glmPort": 0,
            "passbackUrl": null,
            "optimisticLock": 34,
            "roomPassword": "20OQcr8rLFpdr9LL",
            "maxNumPlayers": 10,
            "queuePosition": 0,
            "futureData": null,
            "expiryTime": 0,
            "gameMode": "CLASSIC",
            "mapId": 1,
            "banOrder": null,
            "gameStateString": "IN_PROGRESS",
            "pickTurn": 8,
            "playerChampionSelections": {
                "array": [
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "leorik25",
                        "spell2Id": 4,
                        "selectedSkinIndex": 0,
                        "championId": 143,
                        "futureData": null,
                        "spell1Id": 3
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "cachamalol",
                        "spell2Id": 4,
                        "selectedSkinIndex": 0,
                        "championId": 5,
                        "futureData": null,
                        "spell1Id": 11
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "velcroso",
                        "spell2Id": 11,
                        "selectedSkinIndex": 0,
                        "championId": 75,
                        "futureData": null,
                        "spell1Id": 4
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "b3licus",
                        "spell2Id": 3,
                        "selectedSkinIndex": 0,
                        "championId": 37,
                        "futureData": null,
                        "spell1Id": 4
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "ramirotheking",
                        "spell2Id": 4,
                        "selectedSkinIndex": 0,
                        "championId": 58,
                        "futureData": null,
                        "spell1Id": 14
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "cr0w112",
                        "spell2Id": 4,
                        "selectedSkinIndex": 0,
                        "championId": 61,
                        "futureData": null,
                        "spell1Id": 21
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "juandice",
                        "spell2Id": 21,
                        "selectedSkinIndex": 0,
                        "championId": 51,
                        "futureData": null,
                        "spell1Id": 4
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "violency",
                        "spell2Id": 4,
                        "selectedSkinIndex": 0,
                        "championId": 104,
                        "futureData": null,
                        "spell1Id": 21
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "hello244",
                        "spell2Id": 14,
                        "selectedSkinIndex": 0,
                        "championId": 45,
                        "futureData": null,
                        "spell1Id": 4
                    },
                    {
                        "dataVersion": 0,
                        "summonerInternalName": "miguel",
                        "spell2Id": 14,
                        "selectedSkinIndex": 0,
                        "championId": 154,
                        "futureData": null,
                        "spell1Id": 4
                    }
                ]
            },
            "passbackDataPacket": null,
            "joinTimerDuration": 12
        },
        "connectivityStateEnum": null,
        "gameName": "match-13625911",
        "playerCredentials": {
            "encryptionKey": null,
            "observerServerIp": "66.150.148.234",
            "playerId": 200066970,
            "handshakeToken": null,
            "dataVersion": 0,
            "serverPort": 0,
            "gameId": 13625911,
            "serverIp": null,
            "lastSelectedSkinIndex": 0,
            "observerServerPort": 80,
            "summonerName": null,
            "observerEncryptionKey": "Jg\/ec3AJhmAWFThfEpbeurnNHBLNNp8u",
            "championId": 0,
            "observer": true,
            "futureData": null,
            "summonerId": 0
        },
        "_success": 1,
        "futureData": null
    }
}

Offline

Insertar CODE, HTML o PHP:
{
    "_": {
        "APP_ID": "server_tracked"
    },
    "success": false,
    "shard": "Latin_America_North:ZmYyODRiMDJlNWUyZDY0YTUxNTM2NTVkMDNlZjJkN2FjMjNkNmJkYQ==",
    "eid": 503,
    "error_message": "There is no current active observable game for this summoner."
}
 
Última edición:
S

Strings

Yo sobre esto no se pero he visto una parte del codigo que puedes "simplificar" echo sprintf( ' . $jd3->icon . ' ); -> echo sprintf($jd3->icon);
 

kazaf

Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Desde
20 Abr 2009
Mensajes
187
Yo sobre esto no se pero he visto una parte del codigo que puedes "simplificar" echo sprintf( ' . $jd3->icon . ' ); -> echo sprintf($jd3->icon);

Si tambien he intentado y nada algo estare haciendo mal pero solo el mensaje del offline sale :(

---------- Post agregado el 29-ago-2013 hora: 00:42 ----------

¿ Hay alguien que pueda ayudarme ?

Estoy que me complico con esto que un alma caritativa me ayude. Bendiciones.

---------- Post agregado el 29-ago-2013 hora: 01:09 ----------

¿Alguien que me pueda ayudar?

---------- Post agregado el 30-ago-2013 hora: 01:21 ----------

Ya logre hacerlo gracias a todos.
 
Última edición:
Arriba