$object = json_decode(file_get_contents('https://api.500px.com/v1/photos/?feature=user&username=nsz&consumer_key=xxx'), true);
此对象具有以下结构:
Array
(
[0] => Array
(
[id] => 176621
[name] => ***
[description] =>
[times_viewed] => 1411
[rating] => 47.7
[created_at] => 2010-10-08T14:39:43-04:00
[category] => 11
[privacy] =>
[votes_count] => 65
[favorites_count] => 8
[comments_count] => 7
[nsfw] =>
[store_width] => 643
[store_height] => 915
[image_url] => http://pcdn.500px.net/176621/6f2932b14d545f9664e9472a01ae74596f8d4588/2.jpg
我想知道的是:如何创建一个foreach循环,将每个文件从[image_url]
保存到我的服务器。
这似乎有效,但我不知道如何制作循环:
copy('http://path/to/image.jpg', 'images/flower.jpg');
提前致谢!