path - PHP - file_put_contents only saves half of the files? -
i have no idea what's going on! there limit on how many files can saved per execution?
so, have array list of urls images on server. works should, , returns valid urls. problem when try save them, 52 files saved when there 100 urls returned. see echo out imagepath before save image, , after counting lines adds 100. (no, of course didn't count them manually!)
i'm running loop:
for ($i=0; $i <= $count; ++$i) { $url = $response['images'][$i]['image']; $path = 'exported/'.$response['images'][$i]['date'].'.jpg'; echo $response['images'][$i]['image'].'<br />'; file_put_contents($path, file_get_contents($url)); } any ideas what's going on? bunch!
do of entries have same value $response['images'][$i]['date']? might generating same output filename ($path) , have files overwriting each other. can try echoing $response['images'][$i]['date'] make sure
Comments
Post a Comment