Reading from a file and preg_match()
Moderator: General Moderators
having this addresses you have to call a javascript function
it can be done something like this:
but you sill need javascript function called openWindow() that does to job for you to open a new tab (if it is possible in js) or window
it can be done something like this:
Code: Select all
foreach ($urls as $url) {
$js .= "openWindow('".$url."');\n";
}
echo "<script>\n".$js."</script>\n";Awesome!arturm wrote:having this addresses you have to call a javascript function
it can be done something like this:but you sill need javascript function called openWindow() that does to job for you to open a new tab (if it is possible in js) or windowCode: Select all
foreach ($urls as $url) { $js .= "openWindow('".$url."');\n"; } echo "<script>\n".$js."</script>\n";
It works. The window opening function is called window.open though.
I stumbled across a weird problem now as I've filled the inbox with new mail (I deleted the old test mails):
When writing to the file it only writes the last email and not the others. I'm not sure why that happens.
print_r ($email); still shows me all the emails, but it wont write that same info to the file for some reason.
When writing to the file it only writes the last email and not the others. I'm not sure why that happens.
Code: Select all
for ($i = 1; $i <= $count; $i++) {
$email = $pop3->get_mail($i);
if ($email == false) {
echo $pop3->error;
continue;
}
echo '<pre>';
print_r ($email);
echo '</pre>';
$file = "email.log";
$fh = fopen($file, 'w') or die("Can't open file");
$readable_email = print_r ($email, true);
fwrite($fh, $readable_email);
fclose($fh);
Last edited by Lethality on Fri May 04, 2007 3:07 pm, edited 1 time in total.
Ok, that worked but it spawned another annoying problem
"Warning: fread() [function.fread]: Length parameter must be greater than 0" ...?
Code: Select all
$file = "email.log";
$fh = fopen($file, 'w') or die("Can't open file");
for ($i = 1; $i <= $count; $i++) {
$email = $pop3->get_mail($i);
if ($email == false) {
echo $pop3->error;
continue;
}
$readable_email = print_r($email, true);
fwrite($fh, $readable_email);
echo '<pre>';
print_r ($email);
echo '</pre>';
}
fclose($fh);
$fh = fopen($file, 'r') or die("Can't open file");
$theData = fread($fh, filesize($file));
fclose($fh);it looks like filesize() returned zero
maybe first show all errors - put this before your code:
and then check what's the output:
maybe first show all errors - put this before your code:
Code: Select all
error_reporting(E_ALL);Code: Select all
echo "size: ".filesize($file)."<br>";