What's wrong with this code is why I can't parse json:

$ch = curl_init("https://tui.taobao.com/recommend?itemid=528936847753&count=20&callback=jsonp293&appid=2338"); curl_setopt($ch, CURLOPT_USERAGENT, 'IE20'); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $page=curl_exec($ch); curl_close($ch); $json = substr($page, 62, -119); $json = json_decode($json,true); print_r($json); 

Closed due to the fact that the question is too general for the participants Dmitriy Simushev , user194374, cheops , Bald , VenZell 18 Jul '16 at 7:58 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And what specifically does not work? What mistakes do you get? In other words, the issue needs more specifics - Dmitriy Simushev 2016 at 6:51 pm
  • @DmitriySimushev Just an empty answer, no error is not the answer. - mega94
  • json_decode does not work. It is necessary through curl? - Mr. Black
  • If you get an empty response from the target site, then JSON has nothing to do with it. And if you understand the result of issuing a script as an empty answer, then you first have to deal with the level of output of PHP errors (because it just silences them) - Dmitriy Simushev
  • one
    For some reason, the json_decode function does not work. Perhaps the problem is in hieroglyphs (or encoding (?)). - Hardc0re 7:02

1 answer 1

The point is really in hieroglyphs, the iconv() function helped.

  • from which charset was converted by this function? - aleksandr barakin
  • @alexanderbarakin iconv("KOI8-U", "UTF-8",$json) but the hieroglyphs were converted into characters, but the necessary information was given. - mega94