【发布时间】:2021-06-19 21:31:25
【问题描述】:
我有这个网址http://bisscloud.britain.edu.pk:8841/BISSJSon/JSonStudentsAll.aspx 其中包含 json 数组形式的数据,我想使用 php 提取数据,我尝试使用 file_get_contents
<?php
error_reporting(E_ALL);
$file = file_get_contents("http://bisscloud.britain.edu.pk:8841/BISSJSon/JSonStudentsAll.aspx");
$data = json_decode($file);
var_dump($data);
?>
但它返回 null 我也尝试使用 CURL 但没有结果
【问题讨论】:
-
Warning: file_get_contents(http://bisscloud.britain.edu.pk:8841/BISSJSon/JSonStudentsAll.aspx): failed to open stream: Operation timed out in php shell code on line 1... 尝试在error_reporting中使用E_ERROR | E_WARNING | E_PARSE你应该会看到 -
谢谢,这就是我得到的警告:file_get_contents(bisscloud.britain.edu.pk:8841/BISSJSon/JSonStudentsAll.aspx): failed to open stream: Connection denied in /home/themessa/public_html/lms/api/json.php on line 4
-
嗨@Omen Khalid,我试试你的示例代码,我得到了一些内容。
-
刚刚尝试访问该 URL,但似乎超时。因此,您的问题与 JSON 无关,URL 根本无法正常工作。从上面的各种报告来看,它非常不可靠
-
@cbrr09 你到底得到了什么