By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,831 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,831 IT Pros & Developers. It's quick & easy.

Using fopen with a URL...

P: n/a
Hi All

In a section of my code I open some other file via an URL to have that code
executed like in

$raw=fopen("http://webserver/some.php?aaa=$a&bbb=$b");
print "<td>$raw<td>";

This works for me, but is this a recommended way to evaluate such php code
stored in an other file ?

Next question is, if I am not interested in the value of $raw,only in the
execution of the file via fopen, can I move the fopen call in the background
like I can do on Unix using the &.
I do the above with a series of different values for $a and $b in a loop, so
it would improve the speed of this code.

Thanks in advance
Heinz


Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
How can that work without a second statement (r, w, etc) in the fopen command? I get an error if I just have the URL--and a "Resource id #2"; it doesn't display the results of the URL for me. :(

Heinz wrote:

In a section of my code I open some other file via an URL to have that code
executed like in

$raw=fopen("http://webserver/some.php?aaa=$a&bbb=$b");
print "<td>$raw<td>";

This works for me, but is this a recommended way to evaluate such php code
stored in an other file ?

Next question is, if I am not interested in the value of $raw,only in the
execution of the file via fopen, can I move the fopen call in the background
like I can do on Unix using the &.
I do the above with a series of different values for $a and $b in a loop, so
it would improve the speed of this code.

Jul 17 '05 #2

P: n/a
Eep˛ wrote:

Don't top post
How can that work without a second statement (r, w, etc) in the fopen command? I get an error if I just have the URL--and a "Resource id #2"; it doesn't display the results of the URL for me. :(


See http://www.php.net/file_get_contents

(fsockopen with fputs/fgets might be better, though, because it supports
timeouts)

JW
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.