I have the following code which uses an array to write the result to file. I want to create another array to read the celebrities array from another file.
<?php
require("class.XMLHttpRequest.php");
function hot($news){
$url="https://localhost/search.aspx?search=".$news."";
$ajax=new XMLHttpRequest();
$ajax->setRequestHeader("Cookie","Cookie: host");
$ajax->open("GET",$url,true);
$ajax->send(null);
if($ajax->status==200){
$rHeader=$ajax->getResponseHeader("Set-Cookie");
if(substr_count($rHeader, "Present!")>0) { return true; }
}else{ return false; }
}
$celebrities = array('britney','gaga','carol');
$filename = 'result.txt';
$handle = fopen($filename, 'a');
foreach($celebrities as $celebrity)
{
if(hot($celebrity)) { fwrite($handle, "{$celebrity}\r\n"); };
}
fclose($handle);
?>
Ben de $celebrities
dosyadan dizi yerine yüklemek istiyorum
$celebrities = array('britney','gaga','carol');
Ben bu işe alamadım. Ben yanlış ne yapıyorum?
<?php
$handle = @fopen('array.txt', "r");
if ($handle) {
while (!feof($handle)) {
$celebrities[] = fgets($handle, 4096);
}
fclose($handle);
}
?>