2

I earlier used imap_open function in php to validate credentials of users from a form and give them login to my website. Now I also want to print their name that can be fetched from Google Servers providing their credentials as input.

I want to Print something like "Hello $gmail->firstname to the website", by providing the same user credentials from form as input to php file.

Is there anyway to do this without using Open ID API ?

My php function to authenticate was similar to this:-

function validate($username,$password) {
    $username = strtolower($username);
    $server="{imap.gmail.com:993/imap/ssl}";
    $result=false;
    $result = imap_open($server,$username,$password);
    if($result) {
            return 1;
    }
    else {
            return 0;
    }
}
Mercury
  • 312
  • 3
  • 20

1 Answers1

2

try php's explode() function.

$string_array = explode("@",$string);
echo $string_array[0];

has ur answer.

Nakshatra
  • 663
  • 1
  • 6
  • 14
  • I think this function has to do with extraction, i was asking code similar to used in Google Open ID. – Mercury Jun 22 '15 at 13:26