[FTP] Écriture dans un fichier à distance
bonjour jaimerai modifier du code php sur une fichier se trouvant a distant voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<?php
if($_POST['envoyer']){
$reference = $_POST['dirname'];
$file_header="ftp://login:pass@www.serveur.com/header.inc5.php";
if($fd=fopen($file_header,"r")){
while(!feof($fd)){
$str=fgets($fd, 255);
if(substr($str,0,10)=="0042"){
$contenuMod=str_replace('0042',$reference, $str);
$contenuMod.=$str;
}
}
}
fclose($fd);
$my_ftp_context = stream_context_create(array('ftp' => array('overwrite' => TRUE)));
$fd=fopen($file_header, 'w', FALSE, $my_ftp_context);
fputs($fd,$contenuMod);
fclose($fd);
}
?>
<body>
<form action="modif.php" method="post" name="form1">
<table width="200" border="">
<tr>
<td>Directory Name</td>
<td><input name="dirname" type="text" /></td>
</tr>
</tr>
<tr>
<td><input name="envoyer" type="submit" value="Create" /></td>
</tr>
</table>
</body>
</html> |
mais il maffiche que le fichier nexiste pas alor que le fichier est bien présent
voici le message d'erreur:
Warning: fopen(www.serveur.com/header.inc5.php): failed to open stream: No such file or directory in......on line 11