Google API images batch search & save, PHP need rewrite code
$30-250 USD
Đang triển khai
Đã đăng vào gần 14 năm trước
$30-250 USD
Thanh toán khi bàn giao
Hello,
We have a zen-cart e-commerce website, selling IT products, which is populated with products from various suppliers, and we need to automatically search and save images, one image for each product.
Total number of products ~ 5.000 so it must be automatic.
We have a php code that used to AUTOMATICALLY search images on google, and save found image to the server. (no user intervention)
All was working until google changed to API.
Code need rewriting to make use of the new API, to search one image for each product in the products database, and automatically save the image to the server.
Also possible a variation that needs user intervention:
3 images are returned and user click on one, which is saved, and script will go to next product to find images.
Small budget, up to $50
part of the old code here:
iteration for each product in the database:
/////////////////////////////////////
$contents = file_get_contents($googleUrl,0,$ctx);
if(preg_match_all('/imgurl\\\\x3d(.*?)\\\\x26/i',$contents,$matches))
{
foreach($matches[1] as $image)
{
if($imageContents = file_get_contents($image,0,$ctx))
{
echo "Found image {$image}\n" . "<br>";
echo "save as :".$pic_filename. "<br>";
file_put_contents($pic_filename,$imageContents);
break;
}
else echo "no picture found <br />";
break;
}
}
/////////////////////////////