简体   繁体   中英

How to receive data from one server to another using PHP

I want to get JSON data from an server and store it to database on my server.

I bought API that returns json, which means that server is not mine but I want to take that data and store it to my server.

How to call API, receive data and store it to my server?

PS That API only allows access from 5 IP addresses and I want to use it for android app. Instead of getting data directly from that server to android phone, I have to store that data to my server and then call GET method on my server to receive results on the android phone. This way I could even use GCM. It doesn't have to be php script. If you have better idea or solution please let me know.

你可以用

$json = json_decode(file_get_contents("http//example.com/path?query"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM