curl_init()的替代?

I'm trying to debug some code using either of these two intrepreters. The code below runs on my GoDaddy site and produces the appropirate output arrays. But, won't run in either of these intrepreters. Is there a way to modify this code to run in the intrepreters so I can get past line 2 of the code? I inclcuded phpinfo(INFO_MODULES); at the end as an aid.

OR do you know of an online intrepreter that will run this code?

https://3v4l.org/

http://www.runphponline.com/

<?php  
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $data = '';

            curl_setopt($ch, CURLOPT_URL, "https://api.iextrading.com/1.0/stock/market/batch?symbols=aapl,tsla,ge&types=quote,earnings,stats");
            $data = curl_exec($ch);
            curl_close($ch);

            $data = json_decode($data, true);

            // debug -------------------------------
            echo '  - ';
            echo (count($data));     // number of elements
            echo " - " . "<br />
";
            var_dump_pre($data);     // dump the array
            echo "-" . "<br />
";
            echo "xxxxxxxxxxxxxx-" . "<br />
";

            function var_dump_pre($mixed = null) {
            echo '<pre>';
            var_dump($mixed);
            echo '</pre>';
            return null;
            }

            phpinfo(INFO_MODULES);
?>
查看全部
dongxun1244
dongxun1244
2018/02/09 22:08
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复