PHP too many variables to write

pepechiter

New Member
I have the following codes:\[code\]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; }} $content1= hot("britney") ? "britney found" : "";$content2= hot("gaga") ? "gaga found" : "";$content3= hot("carol") ? "carol found" : ""; $filename = 'result.txt';$handle = fopen($filename, 'a');fwrite($handle, "$Content1\r\n");fwrite($handle, "$Content2\r\n");fwrite($handle, "$Content3\r\n");fwrite($handle, "$Content4\r\n");fclose($handle);\[/code\]i want to shorten the script cuz i have a lot of $ContentN variablesmaybe something like foreach ??
 
Back
Top