Re: Why Does "function endElement($parser, $name)" Do This?



On Fri, 29 Feb 2008 01:38:39 -0500, maria <maria@xxxxxxxxxxxxxxxxxxx>
wrote:

This is kind of strange.
I open a stream called $fh with name, say, "maria", before the
function below, and then I try to write into the file "maria" to no
avail! I keep getting the error:

"fwrite(): supplied argument is not a valid stream resource in ... ".

We can't use a stream to write into inside endElement?

Here is the function

function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link;
if ($name == "ITEM") {
fwrite($fh,$title);
printf("<dt><b><a
href='%s'>%s</a></b></dt>",trim($link),htmlspecialchars(trim($title)));
printf("<dd>%s</dd>",htmlspecialchars(trim($description)));
$title = "";
$description = "";
$link = "";
$insideitem = false;
}
}

It is part of a PHP-program that reads RSS files and saves them with
certain format added. Everything else works fine.
This piece of code is not mine.
Please help!

maria

BTW,

It won't write into the stream $fh no matter what I try to write.
Thanks!

maria
.



Relevant Pages

  • Re: Why Does "function endElement($parser, $name)" Do This?
    ... I open a stream called $fh with name, say, "maria", before the ... supplied argument is not a valid stream resource in ... ... You haven't passed $fh to the function, so PHP doesn't have a value for it. ... BTW - it's bad practice to use globals. ...
    (alt.php)
  • Re: Why Does "function endElement($parser, $name)" Do This?
    ... I open a stream called $fh with name, say, "maria", before the ... supplied argument is not a valid stream resource in ... ... You haven't passed $fh to the function, so PHP doesn't have a value for it. ... I thought that the function endElement takes only two arguments. ...
    (alt.php)
  • Why Does "function endElement($parser, $name)" Do This?
    ... This is kind of strange. ... I open a stream called $fh with name, say, "maria", before the ... supplied argument is not a valid stream resource in ... ... It is part of a PHP-program that reads RSS files and saves them with ...
    (alt.php)
  • Re: Why Does "function endElement($parser, $name)" Do This?
    ... I open a stream called $fh with name, say, "maria", before the ... supplied argument is not a valid stream resource in ... ... BTW - it's bad practice to use globals. ...
    (alt.php)
  • Re: Pretty printing experts, pretty please?
    ... T _is_ a stream designator for terminal I/O, but FORMAT does not ... streams for *terminal-io*, and because the LispM had windowing, every window ...
    (comp.lang.lisp)