php - why does json_decode break when passed specific strings? -
here function in class called getminecraftprofile.php takes info https://sessionserver.mojang.com/session/minecraft/profile/ dependant on uuid of user , gets array can pick formation from. url strings base64 encoded decodes well.
public function getskin() { $properties = $this->properties; $encoded = json_encode($properties); $imgurl = json_decode(base64_decode(json_decode($encoded,true)[0]['value']),true) ['textures']['skin']['url']; $img = file_get_contents($imgurl); echo($img); }
this file passing in user profile find , skin of profile. profiles works , can see in action @ http://jamesplanet.net/test/src/getskin.php?username=dinnerbone
<?php include ($_server["document_root"] . '/test/src/getminecraftprofile.php' )?> <?php $profile = profileutils::getprofile("useruser3"); //$result = $profile->getskin(); $properties = $profile->getproperties(); $encoded = json_encode($properties); $imgurl = json_decode(base64_decode(json_decode($encoded,true)[0]['value']),true)['textures']['skin']['url']; $img = file_get_contents($imgurl); var_dump($encoded); echo('texture url decoded: ' . $imgurl );
it grinds halt if
$profile = profileutils::getprofile("_jeb");
then throws @ me
warning: file_get_contents(): filename cannot empty in /applications/ampps/www/test/src/getskin.php on line 10 string(908) "[{"name":"textures","value":"eyj0aw1lc3rhbxaioje0mdm0ode0mjk2ndmsinbyb2zpbgvjzci6ijdmm2zjy2zjyzuzotqzntdhzmewmjexytyyodc3mwu0iiwichjvzmlszu5hbwuioijfamviiiwiaxnqdwjsawmionrydwusinrlehr1cmvzijp7fx0=","signature":"xigm9w3mfzhmjlszyrmdaf1ctahhhhswfjrqjgw3nntcyotvkl9imdn6zzpionesfblhwspxfkhrac81+gleucfxlyilzo6qe+\/pycins78b9mxrk7r5xeonnzfhxayo9\/cw5x7v6bfxob2mu9fg7nxt\/b\/u4vypqgsbca+oam7kgomlhkw3wkm1r1djfd5obqwlckhtwxt4k4mqjzthsqe5ffldtcpemoipezw4nhav1qjfxzzlgsedg\/kkzudh6eoz+qufyvhcxgroafwj4tzllbu0qyt8iriu0e5ly96stsecwq27w7tzsumxixrkposlzroi5yqgfmmfoehqo8dlrnxhonmyqpzn2re4ovnbwkqvzoerbigozqssg5xupydffldc20pj9cxctb18k12fxt6w8fj+azyuccprsx\/1rjalkef9w5dcxnlollr5yis8irff3\/gn2srwtg8exjz+6qrb50e02jdytv9dzz853w+tavontskbb8w9ac08xuscffg1kaalilkri8h+76be1pzkrapaow8mpsubd6j+6k0ku5lqdtijz1ptdssvma+p9mwtomqqd7n4hpxehulbv4+phqjzi37s1i6zwyrqbe7raq3zkfdx9ztccmheyk\/vhsboo0qmtm8icococ1l0jv9qrv\/yqrzil03x+oq="}]" texture url decoded:
i know there info there because visible before base64 decode. going wrong?
here illustration of beingness parsed
{"id":"069a79f444e94726a5befca90e38aaf5","name":"notch","properties":[{"name":"textures","value":"eyj0aw1lc3rhbxaioje0mdm0ode0mjiwndusinbyb2zpbgvjzci6ija2owe3owy0ndrlotq3mjzhnwjlzmnhotblmzhhywy1iiwichjvzmlszu5hbwuioijob3rjacisimlzuhvibgljijp0cnvllcj0zxh0dxjlcyi6eyjts0loijp7invybci6imh0dha6ly90zxh0dxjlcy5taw5ly3jhznqubmv0l3rlehr1cmuvytexnmu2owe4ndvlmji3zjdjytfmzgrlogmzntdjogm4mjflymq0yme2mtkzodjlytrhmwy4n2q0ywu5ncj9lcjdqvbfijp7invybci6imh0dha6ly90zxh0dxjlcy5taw5ly3jhznqubmv0l3rlehr1cmuvm2y2odhlmgu2otlim2q5zmu0ndhinwjintbhm2eyodhmowm1odk3njjim2rhztgzmdg4ndixmjjky2i4msj9fx0=","signature":"tjieanbzrhgma7v3n8jn0v/zvpxay4ek44lxsh3kidk4jml8beezzjt/1eixbbxhgmh39e122uo7ehx2piutuiik7zhvao6wy8ymg34rpxjuyg0jzze/tzjkv/kq7bi78m6perfwbsauxjkcd3j0sqlxyvoy9rq2cbygktxnvtozgzxiaqqc5qh/2we704cmuj3wign9fckppva2e+dyu0g8iflvyqnjxxiclokv3jocprywvq0cowjadrgd0+o+dkuftfit/k1olbucegdmqjb9cmcbeetffrjrma6xeoa6ohzblompipltes8lbzqbh38cuf+izpgll1e28bitwpudpabzvxaxkoyb3xynwvtaqyfvzscegobvnv7psx1w+kwu9xjcxc591457bollr2kvrsqbv7p0kbm4qvavpka01bjcmfcddx5prbicl6xecvmkoeqh+qurrf1z9wn0l4oeujmrd8/tbjmjtjtdqcuz5ak7urjhl8itnnlqjx/dsi47dezvfugdsc6ivpdidbqv3myblnnhqe7/+z8dgka+bf/nqw0smdvsnfoxieixmyxpwahmw3/ee21amweuq+rd8l4cd2ftzkq/gv18y3y7cr9fyiku+epccndutyf+y257utcuag7i0vlkibpih46jhpjikhr+iag4urqqa6i="}]}
php base64 json
No comments:
Post a Comment