Jump to content

Some Advanced question


Recommended Posts

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
Share on other sites

<?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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.