[PHP] getting content with fput, SESSIONS and frames
Hi Guys, i wanna get some content from an other website with a sessionid and a frameset. my starting code looks like this: ?PHP $fp = @fopen(http://domain.tld/frameset.php?q=string;, r); if($fp){ while($in = fread($fp, 1024)) $reply .= $in; echo ($fp\n\n); echo ($reply\n\n); fclose($fp); } ? now i got in $replay a frameset that links to the main.php without the session id. the paket header including the forward looks like this: HTTP/1.1 302 Found Date: Mon, 26 Jan 2004 11:38:51 GMT Server: Apache X-Powered-By: PHP/4.3.1 Location: http://domain.tld/c17c340a3e6a2cb268451f3eda5930ce/frameset.php?q=string Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Connection: close Content-Type: text/html now i'm looking for a method to get the location into a $var to extract the sessionid any ideas for that? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting content with fput, SESSIONS and frames
snip HTTP/1.1 302 Found Date: Mon, 26 Jan 2004 11:38:51 GMT Server: Apache X-Powered-By: PHP/4.3.1 Location: http://domain.tld/c17c340a3e6a2cb268451f3eda5930ce/frameset.php?q=string Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Connection: close Content-Type: text/html now i'm looking for a method to get the location into a $var to extract the sessionid any ideas for that? /snip take a look at regular expressions, or you could use substr http://www.php.net/substr and strpos http://www.php.net/manual/en/function.strpos.php to extract the location. once you get http://domain.tld/c17c340a3e6a2cb268451f3eda5930ce/frameset.php?q=string into a $var, you could use explode to get this into an array or substr and strpos again to get the session id. I am assuming that c17c340a3e6a2cb268451f3eda5930ce is the session id in your example. these are just a couple I could think of, I am sure there are more ways. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php