X
    Categories: Whatsapp

How to get whatsapp id and password

How to get whatsapp id and password:

Now a days people’s are started to communicate using whatsapp. Whatsapp is officially came for android, windows, and iPhone. Now a days people can access the whatsapp in google chrome by scanning the devices.

Now a days the marketting companies are dealing with the whatsapp to send message to customers as well as other peoples.

When you are trying with whatsapp you need username and password to access it on PC.  On mobile phones you no need to enter password, So now we hav question loike how to login whatsapp without password.

Whats app is still did not provided and official API’s like facebook, twitter. SO we are using third party API to send and recieve whatsapp messages.

When we try to send whatsapp message using php, whatsapp will ask to fill whatsapp id and password, The one who is new to this will get question how can I have my whatsapp password and ID. Here I am going to explain how to obtain whatsapp unique userID and Password.
Setp 1 : Download Latest vesion of WART 1.7.3.0 [https://github.com/mgp25/WART]
Step 2 : Open WART exe file. It will open the form with Phone number and Password filed.


Step 3 : Enter your phonr number along with country code [Ex 9197*********] and press ” ID “button


Step 4 : You will get your unique ID in textarea.


Step 5 : Press ” Request Code ” Button, You will get the password in popup.

Step 6 : Download Whatsapp API file and fill your ID and password in whatsapp.php file.

Thats it, now you are able to send whatsapp message using php.

Check at How to send whatsapp message using PHP.

Below is the code to synchronize google Contacts.

class GoogleContacts implements Contacts
{
    private $config;
    private $curl;
    private $auth;
    private $headers;

    public function __construct()
    {
        $this->curl = curl_init();
    }

    public function getContacts(array $config, $user)
    {
        if (!array_key_exists($user, $config)) {
            throw new Exception("No Credentials for the user requested are available.");
        } else {
            $this->config = $config;
            $contacts = $this->getGoogleContacts($user);
        }
        if (is_array($contacts)) {
            return $contacts;
        }

        return false;
    }

    private function getGoogleContacts($user)
    {
        if (!isset($this->config[$user]['email'])) {
            throw new Exception("Email address for $user was not supplied or set.");
        }

        try {
            $auth = $this->getAuthString($user);
            $this->setHeaders($auth);
            $groupid = $this->getGoogleGroupId('System Group: My Contacts');
            $contacts = $this->retreiveContacts($groupid);
        } catch (Exception $e) {
            throw $e;
        }

        return $contacts;
    }

    private function getAuthString($user)
    {
        // Construct an HTTP POST request
        $clientlogin_url = "https://www.google.com/accounts/ClientLogin";
        $clientlogin_post = array(
            "accountType" => "HOSTED_OR_GOOGLE",
            "Email" => $this->config[$user]['email'],
            "Passwd" => $this->config[$user]['emailPassword'],
            "service" => "cp",
            "source" => "whatsapp"
        );

        // Set some options (some for SHTTP)
        curl_setopt($this->curl, CURLOPT_URL, $clientlogin_url);
        curl_setopt($this->curl, CURLOPT_POST, true);
        curl_setopt($this->curl, CURLOPT_POSTFIELDS, $clientlogin_post);
        curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);

        // Execute
        $authresponse = curl_exec($this->curl);

        // Get the Auth string and save it
        $matches = null;
        $res = preg_match("/Auth=([a-z0-9_-]+)/i", $authresponse, $matches);
        if ($res == 1) {
            $this->auth = $matches[1];

            return $matches[1];
        }
        throw new Exception('Could not get Authentication code from google');
    }

    private function setHeaders($auth)
    {
        $this->headers = array(
            "Authorization: GoogleLogin auth=" . $auth,
            "GData-Version: 2.0",
        );
    }

    private function getHeaders()
    {
        return $this->headers;
    }

    private function getGoogleGroupId($groupname)
    {
        // Connect to Google and get a list of all contact groups.
        curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/m8/feeds/groups/default/full");
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->getHeaders());
        curl_setopt($this->curl, CURLOPT_POST, false);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);

        $groupresponse = curl_exec($this->curl);

        //Load XML response
        $atom = simplexml_load_string($groupresponse);

        //Find the group id for the main contact group.
        foreach ($atom->entry as $entry) {
            if (stristr($entry->title, $groupname) !== false) {
                $contactgroup = $entry->id;
            }
        }

        if (isset($contactgroup)) {
            return $contactgroup;
        } else {
            return false;
        }
    }

    private function retreiveContacts($groupid)
    {
        curl_setopt($this->curl, CURLOPT_URL, "https://www.google.com/m8/feeds/contacts/default/full?max-results=2000&group=$groupid");
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->getHeaders());
        curl_setopt($this->curl, CURLOPT_POST, false);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);

        $contactsresponse = curl_exec($this->curl);
        curl_close($this->curl);

        //Load XML response
        $contactsxml = simplexml_load_string($contactsresponse);
        $data = array();
        foreach ($contactsxml->entry as $entry) {
            $name = $entry->title;
            $gd = $entry->children('http://schemas.google.com/g/2005');
            foreach ($gd->phoneNumber as $p) {
                if ($p->attributes()->rel == "http://schemas.google.com/g/2005#mobile") {
                    $n = trim(preg_replace("/[\D+]*/", "", $p));
                    if (substr((string) $n, 0, 1) !== '0' && strlen($n) > 10) {
                        $data[] = array('name' => "$name ($n)", 'id' => $n);
                    }
                }
            }
        }
        usort($data, array($this, 'sortByName'));

        return($data);
    }

    public function sortByName($a, $b)
    {
        return strcasecmp($a['name'], $b['name']);
    }

}

 

Thanks!. If you like this article don’t forget to share and comment.

 

Marimuthu:

View Comments