【发布时间】:2013-05-16 10:20:20
【问题描述】:
我有一个关于在 javascript 中使用 json(在 php 中加载)的问题。
我从 API 加载 JSON。有人说我最好用 curl 做到这一点?
我搜索了有关 curl 的信息,但没有找到我需要的信息。 这就是我现在所做的:
$url='http://api.urlname.com/api/gateway/call/1.4/getApp?appid=2631';
$str = file_get_contents($url);
$data = json_decode($str);
有人知道我该怎么做吗?
提前致谢!
【问题讨论】:
-
有什么问题?如果这可行,那么为什么需要使用 cURL?还有,这和 JavaScript 有什么关系?
标签: php javascript json api curl