file get contents - How to make synchronous file_get_contents() GET request in PHP -


on site, needed way share session data between 2 domains (one using shared ssl certificate, , other 1 on plain http) redirect user secure domain normal 1 after logging in, while preserving session data.

so came with:

  1. the user enters credentials in secure login page , submits form.

  2. when form submitted, page refreshes. upon refresh, user authenticated, session started , session variables set. then, sid of user on secure domain gets sent data page on non-secure domain, secure sid set session variable.

  3. the user gets redirected main non-secure page, session started, secure sid read, , finally, session on non-secure domain restarted secure sid. way, same session preserved across domains.

there 1 problem approach, file_get_contents() make gets canceled code reaches redirect header. in code:

    //the following line never completes     file_get_contents('http://nonsecuresite.com/cookie.php?sid=session_id()');     header('location: http://nonsecuresite.com'); 

of course sid encrypted, omitted sake of clarity.

is there way make script wait request complete before moving on next page, synchronous file_get_contents function?


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -