无法从网址解析json

时间:2019-08-03 19:00:30

标签: php json react-native host

我已经使用localhost尝试了以下所有代码,并且它们都在正常运行,我将以下代码传输到subdomin进行尝试,但是我得到了奇怪的代码,而不是下载无效的JSON文件,我使用了React Native和Android设备。

subdomin是:http://golbune.gigfa.com/index.php

php代码:

    $aswers = array();
    $aswers['0'] = $other['0']['n1'] . " " . $other['0']['n2'];
    $aswers['1'] = $other['1']['n1'] . '' . $other['1']['n2'];
    $aswers['2'] = $other['2']['n1'] . " " . $other['2']['n2'];
    $aswers['3'] = $r['n1'] . " " . $r['n2'];

    $myarray = array();
    $myarray['0'] = "$rr";
    $myarray['1'] = $aswers;
    echo json_encode($myarray);

反应本机代码:

    const viewData = 'http://golbune.gigfa.com/';

    async function getDataFromServer(){
        try{
            let response = await fetch(viewData,{
                    method: 'POST',
                    headers: {
                        Accept: 'application/json',
                        'Content-Type': 'application/json'
                    },
                });
            let jResponse = await response.json();
            return jResponse;
        }catch(error){
            alert(`${error}`);
        }
    }

我收到的模棱两可的代码是:


    <html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){
       var e=   [

       ]   ;d.replace(/(..)/g,
       function(d)   {
          e.push(parseInt(d,
          16      ))
       }   );return e
    }function toHex(){
       for(var d=   [

       ],
       d=1==arguments.length&&arguments   [
          0
       ]   .constructor==Array?arguments   [
          0
       ]:arguments,
       e="",
       f=0;f<d.length;f++)e+=(16>d   [
          f
       ]   ?"0":""   )+d   [
          f
       ]   .toString(16);return e.toLowerCase()
    }var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),
    b=toNumbers("98344c2eee86c3994890592585b49f80"),
    c=toNumbers("7f325a10749016df7973e65cb4e7d39e");document.cookie="__test="+toHex(slowAES.decrypt(c,
    2,
    a,
    b))+"; expires=Thu,
    31-Dec-37 23:55:55GMT; path=/"; location.href="http://golbune.gigfa.com/?i=1";</script><noscript>This site requires Javascript to work,
    please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>

0 个答案:

没有答案