2013-04-29 61 views

回答

1

那麼爲了下載圖片,您需要向每個網址發送請求。但是,您可以在一個請求中獲得所有URL的列表。您可以使用FQL語句是:

SELEXT pic_big FROM user WHERE uid IN (UID1,UID2,...) 

你會得到類似這樣的迴應:

{ 
    "data": [ 
    { 
     "pic_big": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/xxx.jpg" 
    }, 
    { 
     "pic_big": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/yyy.jpg" 
    }, 
    ... 
    ] 
} 

使用PHP例如,你可以遍歷所有的結果和使用的file_get_contents()組合和file_put_contents()下載圖片:

$imageData = json_decode($fqlResult,true); 
foreach($imageData['data'] AS $key => $value){ 
    file_put_contents('/new/path/to/image',file_get_contents($value)); 
} 
相關問題