gpt4 book ai didi

php - 文件获取内容()错误: "Failed to open stream: HTTP request failed! HTTP/1.1 403 ModSecurity Action"

转载 作者:行者123 更新时间:2023-12-03 07:35:50 25 4
gpt4 key购买 nike

我正在尝试从 PHP 变量中的以下 JSON 数组获取值。

这是数组的 var_dump:

array(1) { [0]=> object(stdClass)#1 (1) { ["row"]=> object(stdClass)#2 (1) { ["u_fname"]=> string(6) "Ashish" } } }

这是我的页面代码

<?php 

$contents = file_get_contents('http://localhost/skillbook/json.php');
$contents = utf8_encode($contents);
$results =var_dump(json_decode($contents));
?>

但是,当我尝试从网上获取服务时,file_get_contents功能不起作用。

file_get_contents(http://...@gmail.com&pass=12345): failed to open stream: HTTP request failed! HTTP/1.1 403 ModSecurity Action in C:\xampp\htdocs\skillbook\json1.php

最佳答案

$contents = file_get_contents('http://localhost/skillbook/json.php');
$contents = utf8_encode($contents);
$contents_array = json_decode($contents,1);

$foundvalue= $contents_array[0]["row"]["u_fname"];
echo $foundvalue;

输出:Ashish

关于php - 文件获取内容()错误: "Failed to open stream: HTTP request failed! HTTP/1.1 403 ModSecurity Action",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35618958/

25 4 0