Re: fopen won't work :(
| From: | Police Trainee | Date: | Thu, 01 May 2003 07:42:25 +0000 |
| Subject: | Re: fopen won't work :( | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145910@lists.php.net to get a copy of this message | ||
didn't work. got:
Warning: fopen(http://www.wiu.edu/stu/)
[function.fopen]: failed to create stream: Invalid
argument in
/hsphere/local/home/user/domain/index.phtml on line 2
Warning: fread(): supplied argument is not a valid
stream resource in
/hsphere/local/home/user/domain/index.phtml on line 3
Warning: fclose(): supplied argument is not a valid
stream resource in
/hsphere/local/home/user/domain/index.phtml on line 7
tried both with and without trailing slash. worked
once again for yahoo (but also slowly)
--- dwalker <dwalker@healthyproductsplus.com> wrote:
> try something like:
>
> <?php
>
> $filedata=fopen("http://www.someplace.com","r")
> ;
> while ($line=fread($filedata,100))
> {
> $ var.=$line;
> }
> fclose ($filedata);
>
>
>
>
> ?><?php $text = $var; ?><?php
> function safeHTML($text)
>
> // $text = stripslashes($text);
> // $text = ereg_replace ("<a[^>]+href *= *([^
> ]+)[^>]*>", "<a
> href=\\1>", $text);
> // $text = ereg_replace ("<([b|i|u])[^>]*>",
> "<\\1>", $text);
> $text = preg_replace
> ("/<title[^>]*>/","<!--",$text);
> // $text = strip_tags($text, '<table>');
> // $text=
> preg_replace("/<table[^>]*?/>.*?","kk",$text);
> // $text=
>
ereg_replace("<script[^>]*>[\w|\t|\r|\W]*</script>","",$test)
> ;
> file://$text=
>
ereg_replace("<title[^>]*>*</title>","",$test);
> file://$text=
>
ereg_replace("<[^>\s]*\btitle\b[^>]*>","lll",$test);
> return $text;
>
> }
> ?>
>
> -----Original Message-----
> From: Police Trainee <policetrainee@yahoo.com>
> To: PHP <php-general@lists.php.net>
> Date: Thursday, May 01, 2003 12:52 AM
> Subject: [PHP] fopen won't work :(
>
>
> >hello. i have been asking for help to get a remote
> >html file echoed onto my webpage since include()
> >doesn't seem to work with it anymore since the new
> php
> >version/server.
> >
> >one of the list users suggested fopen(). I have
> used
> >the following code both with and without the
> trailing
> >url slash:
> >
>
> >><?$fp=fopen("http://www.wiu.edu/stu/","r");
> >while (!feof ($fp)){
> >$buffer=fgets($fp,4096);
> >echo $buffer;}?>
> >
> >but i get the following results with the errors on
> >line 2 and 3 repeating over and over and over below
> >what is displayed below:
> >
> >Warning: fopen(http://www.wiu.edu/stu/)
> >[function.fopen]: failed to create stream: Invalid
> >argument in
> >/hsphere/local/home/user/domain/index.phtml on line
> 1
> >
> >Warning: feof(): supplied argument is not a valid
> >stream resource in
> >/hsphere/local/home/user/domain/index.phtml on line
> 2
> >
> >Warning: fgets(): supplied argument is not a valid
> >stream resource in
> >/hsphere/local/home/user/domain/index.phtml on line
> 3
> >
> >
> >what's wrong? it works with yahoo.com but it takes
> >like 15 seconds (just like include() does now for
> the
> >sites that work with it). is this possibly a server
> >config problem? allow url fopen is on. what should
> i
> >check or do? thanks
> >
> >__________________________________
> >Do you Yahoo!?
> >The New Yahoo! Search - Faster. Easier. Bingo.
> >http://search.yahoo.com
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com