zimbra-api / soap-api

Zimbra SOAP client in PHP language
BSD 3-Clause "New" or "Revised" License
62 stars 48 forks source link

Fatal error: Uncaught Zimbra\Common\Soap\Exception: no valid authtoken present in Common\Soap\AbstractApi.php #55

Closed rizalhrm closed 1 year ago

rizalhrm commented 1 year ago
<?php declare(strict_types=1);

require_once 'vendor/autoload.php';

use Zimbra\Mail\MailApi;

$query = 'in:inbox has:attachment';

$api = new MailApi('https://mycompanyserverzimbra.com/service/admin/soap');
$api->authByAccountName('rizalhrm@mycompanyserverzimbra.com', 'mypassword');
$response = $api->search($query, FALSE, 'message');
$messages = $response->getMessageHits();
var_dump($messages);

I tried the basic usage example above (based on https://github.com/zimbra-api/soap-api/blob/master/docs/usage.md) and got an error like : "Fatal error: Uncaught Zimbra\Common\Soap\Exception: no valid authtoken present in D:\Development\soap-api\src\Common\Soap\AbstractApi.php on line 177".

Is there a solution to handle errors like the one above?

rizalhrm commented 1 year ago

turns out the user has a different soap api url