使用PHP从URL检索和格式化数据 [英] Retrieving and formatting data from a URL using PHP
问题描述
网址。 tracker.ets2map.com/v2/fullmap 包含我想要获取的数据的数据。
我希望格式化将这些数据放入下面显示的文件中。
[ snowball-gaming.com/2json.php ]
我怎么能这样做?
我已经尝试了几种方法来检索数据,但我不知道如何格式化检索数据。
感谢您的帮助!
我的尝试:
<?php
$ content = file_get_contents(http://tracker.ets2map .com / v2 / fullmap);
$ result = json_decode($ content);
print_r($ result);
或
<?php
$ content = file_get_contents(http://tracker.ets2map.com/v2/fullmap);
$ result = json_decode($ content,true);
echo'
The web address. tracker.ets2map.com/v2/fullmap Contains the data the data which I want to get.
I then wish to format this data into the form in the document shown below.
[snowball-gaming.com/2json.php]
How could i go about doing this?
I have tried several methods to retrieve the data, but i do not then know how to format the retrieved data.
Thanks for any help!
What I have tried:
<?php
$content = file_get_contents("http://tracker.ets2map.com/v2/fullmap");
$result = json_decode($content);
print_r($result);
or
<?php
$content = file_get_contents("http://tracker.ets2map.com/v2/fullmap");
$result = json_decode($content,true);
echo '
';
print_r($result);
or Curl (but no example)
推荐答案
content = file_get_contents(http: //tracker.ets2map.com/v2/fullmap);
content = file_get_contents("http://tracker.ets2map.com/v2/fullmap");
result = json_decode(
result = json_decode(
content);
print_r(
content);
print_r(
这篇关于使用PHP从URL检索和格式化数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!