Closed mathishuettl closed 7 years ago
Hello,
To work out of the box download 0.1 branch otherwise you'll need to setup php-http/client-implementation before because v1 doesn't depend on any specific http request provider.
hey, with 0.1 i get the following error:
Notice: Constant PLUGINDIR already defined in /html/sandbox/wp-content/plugins/ep-trauernachricht/ep-trauernachricht.php on line 18
Fatal error: Uncaught exception 'OneSignal\Exception\OneSignalException' in /html/sandbox/wp-content/plugins/ep-push/onesignal-php-api-0.1/src/OneSignal.php:123 Stack trace:0 /html/sandbox/wp-content/plugins/ep-push/onesignal-php-api-0.1/src/Apps.php(55): OneSignal\OneSignal->request('GET', '/apps', Array)
1 /html/sandbox/wp-content/plugins/ep-push/class.ep-push.php(35): OneSignal\Apps->getAll()
2 /html/sandbox/wp-content/plugins/ep-push/class.ep-push.php(20): ep_push->__construct()
3 /html/sandbox/wp-content/plugins/ep-push/class.ep-push.php(14): ep_push::Instance()
4 [internal function]: ep_push::init('')
5 /html/sandbox/wp-includes/plugin.php(524): call_user_func_array(Array, Array)
6 /html/sandbox/wp-settings.php(411): do_action('init')
7 /html/sandbox/wp-config.php(115): require_once('/html/sandbox/w...')
8 /html/sandbox/wp-load.php(39): require_once('/html/sandbox/w...')
9 /html/sandbox/wp-admin/admin.php(31): require_once('/html/sandbox/w...')
10 /html/sandbox/wp-admin/index.php(10): require_once('/html in /html/sandbox/wp-content/plugins/ep-push/onesignal-php-api-0.1/src/OneSignal.php on line 123
`<?php use OneSignal\Config; use OneSignal\Devices; use OneSignal\OneSignal;
class ep_push {
private $config;
private $guzzle;
private $client;
private $api;
public static function init() {
$test = self::Instance();
}
public static function Instance() {
static $inst = null;
if ($inst === null) {
$inst = new ep_push();
}
return $inst;
}
private function __construct() {
require_once(EP_PUSH_DIR . "onesignal-php-api-0.1/vendor/autoload.php");
$this->config = new Config();
$this->config->setApplicationId("secret");
$this->config->setApplicationAuthKey("secret");
$this->api = new OneSignal($this->config);
$myApps = $this->api->apps->getAll();
}
}
?>`
So catch the exception to debug the problem, maybe your config is wrong
ok thanks now i get "Invalid or missing authentication token"
https://github.com/norkunas/onesignal-php-api/tree/0.1#initialize you can see here three config parameters:
$config->setApplicationId('your_application_id');
$config->setApplicationAuthKey('your_application_auth_key');
$config->setUserAuthKey('your_auth_key');
So configure all of them and then you don't have to worry about something missing then ;)
Hello,
i did the following: download the repository as zip and unzipped the "onesignal-php-api-master" folder to my working direcotry then hit composer install in this folder.
My class looks like this: `<?php use GuzzleHttp\Client as GuzzleClient; use Http\Adapter\Guzzle5\Client as GuzzleAdapter; use Http\Client\Common\HttpMethodsClient as HttpClient; use Http\Message\MessageFactory\GuzzleMessageFactory; use OneSignal\Config; use OneSignal\Devices; use OneSignal\OneSignal;
?>`
but i get the following error message: Uncaught Error: Class 'Http\Adapter\Guzzle5\Client' not found