bellow is my entire file, the problem is when i insert multiple links, it only fatch 1 link from the textarea and then giving me the following error on the rest, FYI there is no problem with the reading part in the text area i can read line by line of the link i insert to the textarea..

Warning: fopen( ) [function.fopen]: failed to open stream: HTTP request failed! in H:\Developments\www\check.php on line 30
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


<form action="check.php" method="post"><textarea name="ta" cols="50" rows="10"></textarea><input name="" type="submit" /></form>

if (isset($_POST['ta'])){
$textarea = $_POST['ta'];

$check = explode("\n", trim($textarea));
$lines = count($check);

echo "Lines: $lines";

for ($i = 0; $i < count($check); $i++) {
      echo '  <div>'.$check[$i].'</div>';
	  set_time_limit (24 * 60 * 60);
		 $destination_folder = 'u/';

		$url = $check[$i];
		$newfname = $destination_folder . basename($url);
		$file = fopen ($url, "rb");
		if ($file) {
		  $newf = fopen ($newfname, "wb");
		  if ($newf)
		  while(!feof($file)) {
			fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
		if ($file) {
		if ($newf) {
		echo basename($url);
    } }?>

nvm guy , the problem was with a space in the urls by using a trim in my $url it works now..

$url = trim($check[$i]);

Could you post the url's that you are trying to post via textarea ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.