I am downloading property images from MLS RETS server. When I am using GetObject
method to download property images, sometimes Getobject
method does not return success parameter then image does not download on local server. Is any solution on it?
Here is my code :
$photos = $rets->GetObject("Property", "Photo", $idata['propertymlsid'], "*", 0);
foreach ($photos as $photo)
{
$imgval="";
$imgval="{$photo['Content-ID']}-{$photo['Object-ID']}.jpg";
if ($photo['Success'] == true)
{
@file_put_contents("photos/{$photo['Content-ID']}-{$photo['Object-ID']}.jpg", $photo['Data']);
@mysql_query("insert into tableName (pro_mlsid,photos_name,image_date)values('".$idata['propertymlsid']."','".$imgval."','".date('Y-m-d h:i:s')."')");
}else
{
// in this section i want to download image. please suggest what to do here? . i have record for this image in database for but could not download it.
}
}
please go through the code. i want to download image in else section of above code.