Using fopen with a URL...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Heinz

    Using fopen with a URL...

    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("htt p://webserver/some.php?aaa=$a &bbb=$b");
    print "<td>$raw<t d>";

    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




  • Eep²

    #2
    Re: Using fopen with a URL...

    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:[color=blue]
    >
    > In a section of my code I open some other file via an URL to have that code
    > executed like in
    >
    > $raw=fopen("htt p://webserver/some.php?aaa=$a &bbb=$b");
    > print "<td>$raw<t d>";
    >
    > 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.[/color]

    Comment

    • Janwillem Borleffs

      #3
      Re: Using fopen with a URL...

      Eep² wrote:

      Don't top post
      [color=blue]
      > 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. :([/color]

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

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

      JW


      Comment

      Working...