Hi I have this IMDB parser that gets movie details from IMDB, as im sure your aware you cannot hotlink to the images in IMDB so have found a curl function that displays the picture, QUestion is, Can I save this picture to manipulate it with class.upload.php; Code is here <?php /* * Example using "file_get_contents" * note: allow_url_fopen = On in your php.ini should be On */ //get a video detail site from imdb.com $imdb_website = file_get_contents ('http://www.imdb.com/title/tt0139134/'); //movie PI //include the things we need include 'libs/class.imdb_parser.php'; include 'mysqlconfig.php'; include 'libs/class.upload.php'; //init the class $IMDB_Parser = new IMDB_Parser; // output movie-name $moviename = mysql_real_escape_string($IMDB_Parser->getMovieTitle($imdb_website)); // output movie-plot $plot = mysql_real_escape_string($IMDB_Parser->getMoviePlot($imdb_website)); // output runtime $runtime = mysql_real_escape_string($IMDB_Parser->getMovieRuntime($imdb_website)); // output movie-picture path $imgurl = mysql_real_escape_string($IMDB_Parser->getMoviePicture($imdb_website)); //Genres $genres = ''; foreach($IMDB_Parser->getMovieGenres($imdb_website) as $value) { $genres = $genres.', '.$value; } if(mysql_query("INSERT INTO moviecontent (moviename, plot, runtime, imgurl) VALUES ('$moviename', '$plot', '$runtime', '$imgurl')") or die (mysql_error())) { $ch = curl_init($imgurl); if (!$ch) { die('Cannot allocate a new PHP-CURL handle'); } // We’ll be returning this transfer, and the data is binary // so we don’t want to NULL terminate curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); // Grab the jpg and save the contents in the $data variable $imgurl = curl_exec($ch); // close the connection curl_close($ch); // Set the header to type image/jpeg, since that’s what we’re // displaying header("Content-type: image/jpeg"); // Output the image print($imgurl); /* echo '<img src="'.$imgurl.'" /><br /><br />'; echo $imgurl; */ } else { echo 'Error'; } PHP:
Use something like this to save it: $fp= fopen('filename.jpg', 'w'); fwrite($fp, $imgurl); fclose($fp); print ' <img src="filename.jpg"> '; Comment the header code as well using// signs regards