I have a issue trying to save an object into session.
From my index.php I create the object and store it into session:
include_once __DIR__.'/vendor/autoload.php';
use Axiom\Rivescript\Rivescript;
$test = new Rivescript();
$test->load(realpath(__KNOWLEDGE__));
session_start();
if (isset($_SESSION['ENGINE'])){
unset($_SESSION['ENGINE']);
}
$_SESSION['ENGINE'] = $test;
in another php page I recall the session to get te object:
session_start();
if (!isset($_SESSION['ENGINE'] )){
// error
}else{
$test = $_SESSION['ENGINE'];
$txt = $test->reply($input,$client_id);
}
This page is called by AJAX.
and I get this error:
Notice: Trying to get property 'memory' of non-object in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php on line 64
Fatal error: Uncaught Error: Call to a member function substitute() on null in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php:64 Stack trace: #0 /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php(33): Axiom\Rivescript\Cortex\Input->cleanOriginalSource() #1 /var/www/html/vendor/axiom/rivescript/src/Rivescript.php(34): Axiom\Rivescript\Cortex\Input->__construct('ciao', '5e5fe0688782a') #2 /var/www/html/include/bot.php(24): Axiom\Rivescript\Rivescript->reply('ciao', '5e5fe0688782a') #3 {main} thrown in /var/www/html/vendor/axiom/rivescript/src/Cortex/Input.php on line 64
Any help ??
Related
My webpage gives the "methods with the same name as their class will not be constructors in a future version of php" error with the below code.
When I change the "function settings()" to "function __construct()", the web page gives a fatal error.
Fatal error: Uncaught Error: Call to undefined method validator::settings() in /home/mertcek1563/public_html/rmd2015/sdwf/validator.php:11
Stack trace:
#0 /home/mertcek1563/public_html/rmd2015/z_common.php(103): validator->__construct()
#1 /home/mertcek1563/public_html/rmd2015/z_core.php(22): include('/home/mertcek15...')
#2 /home/mertcek1563/public_html/rmd2015/index.php(2): include('/home/mertcek15...')
#3 {main}
thrown in /home/mertcek1563/public_html/rmd2015/sdwf/validator.php on line 11
How I can fix this code?
class settings
{
var $settings = array();
function settings(){
$this->settings["price"]=array();
$this->settings["price"]["dot"]=".";
$this->settings["price"]["decimals"]=6;
$this->settings["date"]=array();
$this->settings["date"]["delimiter"]="/";
$this->settings["date"]["format"]="dd/mm/yyyy";
$this->settings["number"]=array();
$this->settings["number"]["dot"]=".";
$this->settings["number"]["decimals"]=6;
}
}
Then I end up with fatal error:
Fatal error: Uncaught Error: Call to undefined method
validator::settings() in
/home/mertcek1563/public_html/rmd2015/sdwf/validator.php:11
<?
include_once("settings.php");
class validator extends settings
{
var $errors = array();
var $required = array();
function __construct(){
$this->settings();
}
My code, script start.php in app folder:
require __DIR__ . '../../dropbox-php-sdk-master/vendor/autoload.php';
session_start();
$_SESSION['user_id'] = 1;
$dropboxKey = '';
$dropboxSecret = '';
$appName = '';
$appInfo = new Dropbox\AppInfo($dropboxKey,$dropboxSecret);
My folder structure:
1.app
1.1. start.php
2.dropbox-php-sdk-master
2.1.vendor
2.1.1. autoload.php
3.index.php (calls function start.php)
And when I call the index.php i recive this erro:
Fatal error: Uncaught Error: Class 'Dropbox\AppInfo' not found in C:\xampp\htdocs\tutorials\dropboxapi\app\start.php:12 Stack trace: #0 C:\xampp\htdocs\tutorials\dropboxapi\index.php(3): require() #1 {main} thrown in C:\xampp\htdocs\tutorials\dropboxapi\app\start.php on line 12
I follow some tutorials on the internet and they all have the same structure, what Im doing bad?
We have wsdl :
http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl
IN PHP FILE : i have created a Class with some arrays in it..
class Crmtet {
public $abc;
public $abc2;
public $abc3;
public $abc4;
}
$client = new SoapClient(http://xxxxxxxxxxxxxxx.com/XXXX_Beta_3_API/webservice.asmx?wsdl);
$obj = new Crmtet();
$obj->abc= "Test";
$obj->abc2= "Test2";
$obj->abc3= "Test3";
$obj->abc4= "Test4";
$result = $client->CRM_Warehouse_Master_Insert($obj)->CRM_Warehouse_Master_InsertResult;
echo"re".$result;
But i am getting below error :
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was
unable to process request. ---> Object reference not set to an
instance of an object. in
E:\EasyPHP-12.1\www\test\inserwarrecrm.php:60 Stack trace: #0
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->__call('CRM_Warehouse_M...', Array) #1
E:\EasyPHP-12.1\www\test\inserwarrecrm.php(60):
SoapClient->CRM_Warehouse_Master_Insert(Object(Crmtet)) #2 {main}
thrown in E:\EasyPHP-12.1\www\test\inserwarrecrm.php on line 60
What is the issue.. can anyone help..??
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.
$param['websiteConfigID'] = 729872;
$param['numberOfRecords'] = 10;
$param['numberOfRecords'] = 10;
$client = new SoapClient(WSDL);
$result = $client->__soapCall('GetTicketsStringInputs', array('parameters' => $param));
$result holding this error message....
Fatal error: Uncaught SoapFault exception:
[Client] Function ("GetTicketsStringInputs") is not a valid method for this service in /home/fmticket/public_html/inc/genericLib.php:279
Stack trace:
#0 /home/fmticket/public_html/inc/genericLib.php(279): SoapClient->__soapCall('GetTicketsStrin...', Array)
#1 /home/fmticket/public_html/resultsTicket.php(12): getTickets(Array)
#2 {main} thrown in /home/fmticket/public_html/inc/genericLib.php on line 279
how to resolve it?? plz help.
Your code is calling the remote GetTicketsStringInputs function :
$client->__soapCall('GetTicketsStringInputs', ...
The Fatal error you get indicates :
Function ("GetTicketsStringInputs") is not a valid method for this service
It seems pretty clear : the method you're trying to call doesn't exist, it is not provided by the remote web-service.
So, to fix that Fatal Error, you have to stop calling that function ;-)
You should check the WSDL of your webservice : does it really export such a method ?