issues running php as it unable to find the file - php

I am using the following to run the php file under xampp htdocs with foldername as kraken but i am getting an error
<?php
require_once 'KrakenAPIClient.php';
$key = 'dfdfdfdf';
$secret = 'dfdfdfdf';
// set which platform to use (currently only beta is operational, live available soon)
$beta = false;
$url = $beta ? 'https://api.beta.kraken.com' : 'https://api.kraken.com';
$sslverify = $beta ? false : true;
$version = 0;
$kraken = new KrakenAPI($key, $secret, $url, $version, $sslverify);
error i am getting is:
Fatal error: Uncaught Error: Class 'KrakenAPI' not found in C:\xampp\htdocs\kraken\example.php:21 Stack trace: #0 {main} thrown in C:\xampp\htdocs\kraken\example.php on line 21

You'd need to alias the class with use, before being able to skip it's name-space:
use \Payward\KrakenAPI;
Also see the PHP manual which I've linked for a more detailed explanation.

Related

I can't solve this Fatal error problem with pdfMerger

I'm trying to merge some pdf's, but I have a problem that I can't understand and I don't know what's happening, Can someone help me?
Attached code in PHP
This is the method for pdfMerger
public static function pdfMerger($archivos, $destino){
$pdf = new PDFMerger(); // or use $pdf = new \PDFMerger; for Laravel
if($archivos != null){
for($i=0; $i < count($archivos); $i++){
$pdf->addPDF($archivos[$i], 'all');
}
}
$pdf->merge('file', $destino);
}
And here is where I'm calling the method:
//This is a test
$control = new FilesController();
$dir = "/Jomar/induccion/documents/";
$files = glob($_SERVER['DOCUMENT_ROOT']."{$dir}politicas empresa/*.pdf");
$url = $_SERVER['DOCUMENT_ROOT']."{$dir}politicas empresa/prueba.pdf";
print_r($files);
$control->pdfMerger($files, $url);
This is the error I'm currently receiving:
Fatal error: Uncaught Exception: TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code in C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php:474 Stack trace: #0 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php(359): TCPDF_FILTERS::Error('decodeFilterFla...') #1 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php(94): TCPDF_FILTERS::decodeFilterFlateDecode('\xEA\x91\xB9mj/\xAB\x8E;iN\xA3\x143\xAF...') #2 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi_parser.php(1310): TCPDF_FILTERS::decodeFilter('FlateDecode', '\xEA\x91\xB9mj/\xAB\x8E;iN\xA3\x143\xAF...') #3 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi_parser.php(1249): tcpdi_parser->_rebuildContentStream(Array) #4 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\tcpdi.php(192): tcpdi_parser->getContent() #5 C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\PDFMerger.php(104): TCPDI->importPage(1) in C:\xampp\htdocs\Jomar\induccion\config\PDFMerger-master\tcpdf\include\tcpdf_filters.php on line 474
(Sorry for my english)
The problem was of the permissions of the pdf, therefore, is necessary to check that in the pdf document doesn't have any type of restrictions. thanks for your help.

Zend framework 3 and rackspace authenticate() is not working

This code was working fine with zf2 but when i migrated to ZF3 it is giving me the following error
$user = 'username';
$key = 'secret key';
$rackspace = new ZendService\Rackspace\Files($user,$key);
if ($rackspace->authenticate()) {
printf("Authenticated with token: %s",$rackspace->getToken());
} else {
printf("ERROR: %s",$rackspace->getErrorMsg());
}
File : zendframework\zendservice-rackspace\library\ZendService\Rackspace\AbstractRackspace.php:365
Message: Call to a member function getFieldValue() on boolean
The error is from the Rackspace library, I haven't use getFieldValue() anywhere
IN the Library itself there is a line that was causing the error
The line 401 in AbstractRackspace.php
$this->managementUrl = $result->getHeaders()->get(self::MANAGEMENT_URL)->getFieldValue();
the error was due to this line as the MANAGEMENT_URL is not set there in the header. i commented that line in the file and the error is gone

Uncaught SoapFault

I am getting the following error when trying to create a new SoapClient.
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://api.mindbodyonline.com/0_5/ClassService.asmx?wsdl' : failed to load external entity "https://api.mindbodyonline.com/0_5/ClassService.asmx?wsdl" in C:\xampp\htdocs\Work\Ice\default\soaptest.php:8 Stack trace: #0 C:\xampp\htdocs\Work\Ice\default\soaptest.php(8): SoapClient->SoapClient('https://api.min...') #1 {main} thrown in C:\xampp\htdocs\Work\Ice\default\soaptest.php on line 8
what would cause the WSDL to not load?
Enable openssl in your php.ini you load the WSDL over https this is only working when the openssl module is enabled.
Not sure if this might be the case with you but if you are using the PHP classes provided on the Minbody API on Github, note that they have recently updated them. I had the same problem with classService.php. If you are using classService.php, update the constructor function to the following (same will apply to other services):
function __construct($debug = false)
{
$endpointUrl = "https://" . GetApiHostname() . "/0_5/ClassService.asmx";
$wsdlUrl = $endpointUrl . "?wsdl";
$this->debug = $debug;
$option = array();
if ($debug)
{
$option = array('trace'=>1);
}
$this->client = new soapclient($wsdlUrl, $option);
$this->client->__setLocation($endpointUrl);
}

whatsapp api request code not executing and not returning a request code

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.

How to fix error returned by __soapCall?

$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 ?

Categories