gpt4 book ai didi

php - 从远程服务器解析 JSON 数据

转载 作者:可可西里 更新时间:2023-11-01 13:37:00 26 4
gpt4 key购买 nike

我想知道是否有任何方法可以在 PHP 中创建一个解析器,从该站点获取值 https://btc-e.com/api/2/btc_usd/ticker并将它们设置为 php 代码中的变量?

我稍微研究了一下 php 解析器,我唯一发现的是能够回显网站上所有信息的解析器。

最佳答案

由于该 URL 返回一个 JSON 响应:

<?php

$content=file_get_contents("https://btc-e.com/api/2/btc_usd/ticker");
$data=json_decode($content);
//do whatever with $data now
?>

关于php - 从远程服务器解析 JSON 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21021266/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com