开发者

How do I use php to pull in json from a url for use as a variable? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

Improve this question

I have a url where json is being dynamically loaded. I need to use php to pull in that json and use json_decode to get the info out of it. So far I have not been able to figure out how to get the actual json into my php. What is it that I need to do? Is there a "content" command for php?

Right now I'm trying:

print(json_decode('http://theurl开发者_如何学JAVA.com'));


echo json_decode(file_get_contents('http://theurl.com'));

You can also use cURL instead of file_get_contents for some extra speed and control, but it's relatively complicated to compared to file_get_contents, especially if you've never used it before.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜