Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught Error: Class 'Zendesk\API\HttpClient' not found #329

Closed
shaliniinfris opened this issue Apr 27, 2017 · 1 comment
Closed

Comments

@shaliniinfris
Copy link

Hello,

After installing the composer using below script

// load Composer
require 'vendor/autoload.php';

use Zendesk\API\HttpClient as ZendeskAPI;

$subdomain = "subdomain";
$username = "email@example.com"; // replace this with your registered email
$token = "6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv"; // replace this with your token

$client = new ZendeskAPI($subdomain);
$client->setAuth('basic', ['username' => $username, 'token' => $token]);

I am facing this error -
Fatal error: Uncaught Error: Class 'Zendesk\API\HttpClient' not found in index.php:54 Stack trace: #0 {main} thrown in index.php on line 54

On my localhost using xampp got below error -

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://od-basehelp.zendesk.com/api/v2/tickets.json resulted in a 401 Unauthorized response: {"error":"Couldn't authenticate you"} ' in D:\xampp\htdocs\projects\zendesk\zendesk_api_client_php-master\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:111 Stack trace: #0 D:\xampp\htdocs\projects\zendesk\zendesk_api_client_php-master\vendor\guzzlehttp\guzzle\src\Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 D:\xampp\htdocs\projects\zendesk\zendesk_api_client_php-master\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 D:\xampp\htdocs\projects\zendesk\zendesk_api_client_php-master\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 D:\xampp\htdocs\projects\zendes in D:\xampp\htdocs\projects\zendesk\zendesk_api_client_php-master\vendor\zendesk\zendesk_api_client_php\src\Zendesk\API\Http.php on line 92

@samgavinio
Copy link
Contributor

samgavinio commented Apr 27, 2017

@shaliniinfris you are experiencing two different issues.

Fatal error: Uncaught Error: Class 'Zendesk\API\HttpClient' not found

means that you have either not configured your composer autoloader correctly or have not run composer install yet.

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://od-basehelp.zendesk.com/api/v2/tickets.json resulted in a 401 Unauthorized

This one means that the client can now be autoloaded correctly but you are getting this error because you have not set-up your zendesk credentials yet. Look at https://github.com/zendesk/zendesk_api_client_php#configuration, make sure to update the $subdomain, $token and $username to the one for your zendesk account. If you are unsure how to generate your API token, refer to this helpcenter article: https://support.zendesk.com/hc/en-us/articles/226022787-Generating-a-new-API-token-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants