I am using whatsapi from github and the examples/whatsapp.php. I have configured my number, password etc properly...
however, when i execute the program, after logging in, when i try to select user which is supposed to get my contacts and groups, JS error 'Error: There was an error with the AJAX request. XML/Json format is bad.' comes up.
On checking firbug console, i got the following php error message;
Notice: Undefined index: id in C:\Program Files\EasyPHP-DevServer-14.1VC11\data\localweb\Landshoppe
\WAPP\Chat-API-master\examples\whatsapp.php on line 321
{"success":true,"type":"contacts","data":....
The function which calls it is
public function __construct(array $config)
{
$this->config = $config;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
try {
$this->inputs = $this->cleanPostInputs();
if (isset($this->inputs['from'])) {
$this->from = $this->inputs['from'];
if (!array_key_exists($this->from, $this->config)) {
exit(json_encode(array(
"success" => false,
'type' => 'contacts',
"errormsg" => "No config settings for user $this->from could be found"
)));
} else {
$this->number = $this->config[$this->from]['fromNumber'];
// --This is the Line-- $this->id = $this->config[$this->from]['id'];
$this->nick = $this->config[$this->from]['nick'];
$this->password = $this->config[$this->from]['waPassword'];
$this->wa = new WhatsProt($this->number, $this->nick, false);
$this->wa->eventManager()->bind('onGetMessage', array($this, 'processReceivedMessage'));
$this->wa->eventManager()->bind('onConnect', array($this, 'connected'));
$this->wa->eventManager()->bind('onGetGroups', array($this, 'processGroupArray'));
}
}
} catch (Exception $e) {
exit(json_encode(array(
"success" => false,
'type' => 'contacts',
"errormsg" => $e->getMessage()
)));
}
}
}
after that all groups and contacts are defined therein ! but program is paused with the JSON error !
So what should i do to rectify the 'undefined index id' ?