Wednesday 9 May 2012

Save Image from remote site(cUrl)

<?php

$url = "http://www.indianfootballonline.com/img/sport/sport_318_test-201.gif";
$imgename = 'test.gif';

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$result = curl_exec($ch); 
curl_close($ch);  

file_put_contents($imgename , $result);

?>

No comments:

Post a Comment

Disable Caching Drupal 8

1. Copy and rename the sites/example.settings.local.php to sites/default/settings.local.php: $ cp sites / example . settings . local . ph...