karthikeyan_coder Posted May 12, 2007 Share Posted May 12, 2007 Hello, First of all great thanks to all PHPFreaks... Coz i am getting some new ideas from this forum always... Lets go to the problem... if you type "https://www.google.com/accounts/NewAccount?service=mail" in address bar... google will automatically redirects itself to some page similar like.. https://www.google.com/accounts/NewAccount?service=mail&t=ddac592b-4825b1e3-d59eb27e4391e89e55bd&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-105c945b390a9d18f9cb58c765347318-021b3aca0aa65adf42d2c538e2d9ad4ed1b81d85&type=2 Here is the new values "t" and "continue" google We know "https://www.google.com/accounts/NewAccount?service=mail" only.. we cannt guess the "t" and "continue" values fully anyway... Lets say i have a function to read the urls... getSocket(); $host = "www.google.com"; $url = "/accounts/NewAccount?service=mail"; $responce=getSocket($host,$url,"GET",443); die($responce); the result is... i am redirected to some "https://google.com/NewAccount?service=mail&t=blablab&continue=blab"; My browser url also above... My need is... $host = "www.google.com"; $url = "/accounts/NewAccount?service=mail"; $responce=getSocket($host,$url,"GET",443); //////////////////////////////////////////////////// // ///// // do some operations with $responce ////// /////////////////////////////////////////////////// // And get "t" and "continue" values... ///// // I mean... I want to know that.. what is the redirection url after calling // ///accounts/NewAccount?service=mail////// ////////////////////////////////////////////////// Many sites are doing like google.. i want to know what is the technology behind that.. and how can we guess the redirection url after calling a specific page.... Note: the function getSocket is having pfsockopen() function as a core. Regards, Karthi Keyan. Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/ Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 Use preg_replace to search the $responce variable to get your two values Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251339 Share on other sites More sharing options...
MadTechie Posted May 12, 2007 Share Posted May 12, 2007 humm if thats what his asking then you mean use preg_match or ereg (maybe split) Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251346 Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 I think that he just wants to pull the t and continue variables from the new URL after accessing Gmail. So there's a few ways of doing it really. Explode with "=" deliminator would be my choice Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251348 Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 <?php function textbetweenarray($s1,$s2,$s){ $myarray=array(); $s1=strtolower($s1); $s2=strtolower($s2); $L1=strlen($s1); $L2=strlen($s2); $scheck=strtolower($s); do{ $pos1 = strpos($scheck,$s1); if($pos1!==false){ $pos2 = strpos(substr($scheck,$pos1+$L1),$s2); if($pos2!==false){ $myarray[]=substr($s,$pos1+$L1,$pos2); $s=substr($s,$pos1+$L1+$pos2+$L2); $scheck=strtolower($s); } } } while (($pos1!==false)and($pos2!==false)); return $myarray; } $responce = "https://www.google.com/accounts/NewAccount?service=mail&t=e07357ba-4825d594-1ea1eef7fef1787b06c5&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-105c9caaef3dee307142bc2c8ac845e3-ad0c0669fe8b3c00ba7ceba2241fed143e9d6cac&type=2&gd=1"; $t = textbetweenarray("&t=", "&continue=", $responce); echo "t = $t[0]<br />"; $continue = textbetweenarray("&continue=", "&type=", $responce); echo "continue = $continue[0]"; ?> Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251412 Share on other sites More sharing options...
karthikeyan_coder Posted May 12, 2007 Author Share Posted May 12, 2007 Thank you friends... Done with simple explode(); Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251568 Share on other sites More sharing options...
karthikeyan_coder Posted May 12, 2007 Author Share Posted May 12, 2007 Thanks chigley & MadTechie Link to comment https://forums.phpfreaks.com/topic/51068-some-advanced-question/#findComment-251570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.