differences between header(location:URL) and fopen(URL)

Discussion in 'PHP' started by mehdiali, May 12, 2008.

  1. #1
    Hi there
    $url = "xx/yy/a.thml"
    -----------------
    header("location : $url"); // it works properly

    but

    $file_handle = fopen($url, "r"); // shows that your session is expired
    while (!feof($file_handle))
    echo fgets($file_handle, 4096);
    fclose($file_handle);
    ----------------------
    why?
    thank you all
     
    mehdiali, May 12, 2008 IP
  2. kreoton

    kreoton Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thats because header() function redirects user (visitor) to given location. fopen() function is run in server not in user browser so you get error.
     
    kreoton, May 12, 2008 IP