dovrei creare un file temporaneo, perchè poi questo file temporaneo viene inviato a imagehack.. però non so farlo purtroppo.... mi serve un codice che mi salvi un url qualsiasi con un img come quello che sta sopra in un file temporaneo in modo tale che possa inviarlo a imagehack..
qui codice:

<?php
$url = 'http://www.repubblica.it/images/2011/03/03/194244690-632f7bdb-020d-4405-8c13-6543f425af0c.jpg';
$name = filename_from_uri ($url);

//funzione che salva l'immagine qualsiasi
salvo l'immagine che sta all'url $url in un file tempo /tmp/.$name

come posso fare?


$postData = array();
$postData['fileupload'] = "@/tmp/" . $name;
$postData['submit'] = "Submit";
$postData['key'] = "xxxxxxxxxxxxxxxxxxxxxxxxx";
$postData['rembar'] = "yes";
$postData['xml'] = "yes";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.imageshack.us/index.php");
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 240);curl_setopt($ch, CURLOPT_POSTFIELDS, $postData );

$response = curl_exec( $ch );
curl_close($ch );

echo $response;

function filename_from_uri ($uri) {
$parts = explode('/', $uri);
return array_pop($parts);
echo $parts;
}

?>