I use this code
#!/usr/bin/php
<?php
require_once('whatsapp_whatsapi_config.php');
$destinationPhone = 'xxxx';
$w = new WhatsProt($userPhone,0, $userName, $debug);
$w->Connect();
$w->LoginWithPassword($password);
$message = 'WhatsApp';
$w->Message($destinationPhone, $message);
echo "Mensaje enviado exitosamente";
?>
and this error displayed
PHP Fatal error: Uncaught exception 'LoginFailureException' in /var/www/html/whats/src/whatsprot.class.php:2274
Stack trace:
/var/www/html/whats/src/whatsprot.class.php(552): WhatsProt->doLogin()
/var/www/html/whats/whatsapp_whatsapi_send.php(13): WhatsProt->loginWithPassword('Mu7q0hq/vRSLFCU...')
{main}
thrown in /var/www/html/whats/src/whatsprot.class.php on line 2274
I tried use the WART app but the password generated is incorrect
Add a try-catch clause on the line that has $w->LoginWithPassword($password); and use the getMessage() method on the exception to see what the error message is, and what might be wrong with your login
Related
I have been working at a code that used to work. However, suddenly, this message pops up.
Fatal error: Uncaught exception 'Exception' with message 'Email is incorrect!' in C:\xampp\htdocs\Prototype\classes\User.php:23
Stack trace: #0 C:\xampp\htdocs\Prototype\index.php(14): User->setEmail(true) #1 {main} thrown in C:\xampp\htdocs\Prototype\classes\User.php on line 23
But I just don't understand what this means. I tried using try and catch, but it keeps popping up.
This is the code where the error occurs
public function setEmail($p_email)
{
if (empty($p_email)) {
throw new Exception('Email kan niet leeg zijn!');
}
$this->email = $p_email;
if (!filter_var($p_email, FILTER_VALIDATE_EMAIL)) {
throw new Exception('Email is incorrect!'); //here is the error (line 23)
}
}
this is the code where it is summoned
$user = new User();
$user->setEmail($_SESSION['login']); //line 14
$currentUser = $user->getProfile();
$userEmail = $user->getEmail();
$userName = $user->getUserName();
$userID = $currentUser['userID'];
Your error is that you are passing a boolean instead of a valid string email...
Stack trace: #0 C:\xampp\htdocs\Prototype\index.php(14): User->setEmail(true) #1 {main} thrown in C:\xampp\htdocs\Prototype\classes\User.php on line 23
So, this line is incorrect:
$user->setEmail($_SESSION['login']); //line 14
This is the first time I use parse.com php SDK and I try to execute the following code
<?php require '../autoload.php';
use Parse\ParseObject;
use Parse\ParseClient;
ParseClient::initialize( "Zsr...", "BzM..", "D..." );
$gameScore = new ParseObject("GameScore");
$gameScore->set("score", 1337);
$gameScore->set("playerName", "Sean Plott");
$gameScore->set("cheatMode", false);
try {
$gameScore->save();
echo 'New object created with objectId: ' . $gameScore->getObjectId();
} catch (ParseException $ex) {
// Execute any logic that should take place if the save fails.
// error is a ParseException object with an error code and message.
echo 'Failed to create new object, with error message: ' + $ex->getMessage();
}
?>
But I get that error
Fatal error: Uncaught exception 'Parse\ParseException' with message 'SSL certificate problem: unable to get local issuer certificate' in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php:250 Stack trace: #0 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(925): Parse\ParseClient::_request('POST', '/1/classes/Game...', NULL, '{"score":1337,"...', false) #1 /opt/lampp/htdocs/parse/src/Parse/ParseObject.php(836): Parse\ParseObject::deepSave(Object(Parse\ParseObject), false) #2 /opt/lampp/htdocs/parse/src/hola.php(11): Parse\ParseObject->save() #3 {main} thrown in /opt/lampp/htdocs/parse/src/Parse/ParseClient.php on line 250
The code it's the tutorial code, iI haven't changed anything anyone knows what's the problem?
I am also getting same issue. Now I resolve using some other forums answer.
Open your ParseClient.php and find:
curl_init();
And after that add line add:
curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, false);
It will work.
When i try to run php code using Parse.com PHP SDK it
the error is "Account already exists for this username"
but it throw all this error message:
Fatal error: Uncaught exception 'Parse\ParseException' with message 'Account already exists for this username' in /Users/yousef/Desktop/project/vendor/parse/php-sdk/src/Parse/ParseClient.php:357 Stack trace: #0 /Users/yousef/Desktop/project/vendor/parse/php-sdk/src/Parse/ParseObject.php(1038): Parse\ParseClient::_request('POST', 'classes/_User', NULL, '{"username":"my...', false) #1 /Users/yousef/Desktop/project/vendor/parse/php-sdk/src/Parse/ParseObject.php(947): Parse\ParseObject::deepSave(Object(Parse\ParseUser), false) #2 /Users/yousef/Desktop/project/vendor/parse/php-sdk/src/Parse/ParseUser.php(108): Parse\ParseObject->save() #3 /Users/yousef/Desktop/project/test.php(20): Parse\ParseUser->signUp() #4 {main} thrown in /Users/yousef/Desktop/project/vendor/parse/php-sdk/src/Parse/ParseClient.php on line 357
The Code i Use
<?php
require 'vendor/autoload.php';
use Parse\ParseClient;
ParseClient::initialize('YousefId', '', 'YousefMaster');
ParseClient::setServerURL('server-ip:1337/parse');
use Parse\ParseUser;
$user = new ParseUser();
$user->set("username", "my name");
$user->set("password", "my pass");
$user->set("email", "email#example.com");
$user->set("phone", "415-392-0202");
try {
$user->signUp();
} catch (ParseException $error) {
echo $error->getCode();
echo $error->getMessage();
}
?>
so how do i just show the error code and message instead of showing all this error.
You need to refer to the ParseException within the Parse namespace.
Try
catch (Parse\ParseException $error) {
// ...
}
Hi I keep geting the following error when I try to delete a number from my twilio subaccount using REST API in PHP
my code is;
$number = $twClient->account->incoming_phone_numbers->get($number_Sid);
$twClient->account->incoming_phone_numbers->delete($number->sid);
The error that I am getting is;
[22-Aug-2013 09:40:17 UTC] PHP Fatal error: Uncaught exception 'Services_Twilio_RestException' with message 'The requested resource was not found' in C:\Program Files (x86)\Zend\Apache2\htdocs\twilio-twilio-php- 732e6f6\Services\Twilio.php:226
Stack trace:
#0 C:\Program Files (x86)\Zend\Apache2\htdocs\twilio-twilio-php- 732e6f6\Services\Twilio.php(145): Services_Twilio->_processResponse(Array)
#1 C:\Program Files (x86)\Zend\Apache2\htdocs\twilio-twilio-php-732e6f6\Services\Twilio.php(179): Services_Twilio->_makeIdempotentRequest(Array, '/2010-04-01/Acc...', 1)
#2 C:\Program Files (x86)\Zend\Apache2\htdocs\twilio-twilio-php-732e6f6\Services\Twilio\ListResource.php(71): Services_Twilio->deleteData('/2010-04-01/Acc...', Array)
#3 C:\Program Files (x86)\Zend\Apache2\htdocs\testers\web2call\application\controllers\clientphonenos_controller.php(518): Services_Twilio_ListResource->delete('PN397fc000ce6f8...')
#4 [internal function]: ClientPhoneNos_controller->data_form('delete', '+14139926551_AC...')
#5 C:\Program Files (x86)\Zend\Apache2\htdocs\system\core\Cod in C:\Program Files (x86)\Zend\Apache2\htdocs\twilio-twilio-php-732e6f6\Services\Twilio.php on line 226
If you have already successfully deleted the phone number, Twilio will return a 404 Not Found to you, which the PHP library will interpret as a RestException. You can only delete the phone number one time :)
You can override exception by using this syntax:
try
{
// do something that can go wrong
}
catch (Exception $e)
{
throw new Exception( 'Something really gone wrong', 0, $e);
}
Here's another live sample for sending messages with an exception catcher:
<?PHP
require "Services/Twilio.php";
// Set our AccountSid and AuthToken from twilio.com/user/account
$AccountSid = "{ACCOUNTSID}";
$AuthToken = "{AUTHTOKEN}";
// Instantiate a new Twilio Rest Client
$client = new Services_Twilio($AccountSid, $AuthToken);
/* Your Twilio Number or Outgoing Caller ID */
$from = '2126404004';
$people = array("212-716-1130");
$body = "Enter your text message here";
$errorIds = array(); //user ids array which had broken phones
foreach ($people as $to) {
try
{
$client->account->sms_messages->create($from, $to, $body);
echo "Sent message to: $to \n <br>";
}
catch (Exception $e)
{ //on error push userId in to error array
$count++;
array_push($errorIds, $to);
}
}
print_r($errorIds);
?>
Without catching the exception, the script will die with an error like:
<br>PHP Fatal error: Uncaught exception 'Services_Twilio_RestException' with message 'The message From/To pair violates a blacklist rule.' in /var/www/vhosts/httpdocs/twilio/Services/Twilio.php:149
I am trying to implement the whatsAPI but I always get this error
"There was a problem trying to request the code".
Here is the full error that is showing in my console:
####start of error notice#####
[12-Mar-2013 22:44:59] PHP Notice: Undefined property: stdClass::$reason in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php on line 1268
[12-Mar-2013 22:44:59] PHP Fatal error: Uncaught exception 'Exception' with message 'There was a problem trying to request the code.' in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php:1269
Stack trace:
#0 /Applications/MAMP/htdocs/whatsapp/test/test.php(36): WhatsProt->checkCredentials()
#1 {main}
thrown in /Applications/MAMP/htdocs/whatsapp/test/whatsprot.class.php on line 1269
####end of error notice#####
these are my credentials for initializing the class
$userPhone = '8801770648732';
$userIdentity = '352264050503669';
$userName = 'shishir';
$destinationPhone = '8801713206053';
$debug = TRUE;
$whatsapp = new WhatsProt($userPhone, $userIdentity, $userName, $debug);
and for the requesting a requestCode
$service_type = "sms";
$country_code = "BD";
$language_code = "en";
$request_code = $whatsapp->requestCode($service_type, $country_code, $language_code);
Every time it stuck at the $whatsapp->requestCode with that error. I'm not sure what i am doing wrong . Can anyone help me on this?
It's look like you don't have curl extension.
This Exception is thrown by checkCredentials method.
Check if your phpinfo shows curl.