

Moderator: NADEO
You're doing "POST /maniahome/notification/public/" which is made for sending public notifcations (ie. a notification that will be seen by everyone that bookmark the Manialink" but you specify a receiverName in the object so it fails.fastforza wrote:Oops ... I was using the password from one of my other API users.Although now I'm getting 400 bad request response statuses.
There must be something wrong because I have to trace of requests from the user "jonthekiller|lottomania" in the API access logs. Are you sure you didn't changed the URL or something like that?jonthekiller wrote:I have try the script alone in internet and not ingame at 12h59 and nothing too. Is it possible to add a debug in the script for maybe see the error?
Yes you can.jonthekiller wrote:Can I use the same API account for maniaconnect and for send notification? I use the same actually.
ManiaConnect Authentication and ManiaHome notifications are 2 distinct things. You just need a normal API user to send notifications, even if you send it to a specific login. But obviously this login can come from a ManiaConnect authentication.jonthekiller wrote:The player is already authentificate before access to this page but maybe I need to authentificate again? Or I can just take the login like before?
Code: Select all
<?php
echo "start";
require_once 'libraries/autoload.php';
$login = 'jonthekiller';
$notification = new Maniaplanet\WebServices\Notification();
$notification->receiverName = $login;
$notification->link = 'lottery'; // can also be an URL, or a maniaplanet:/// link
$notification->message = 'jonthekiller has bought a ticket on LottoMania'; // nickname will be prepended in that case
$notification->iconStyle = 'ManiaPlanetLogos';
$notification->iconSubStyle = 'IconPlanetsPerspective';
echo "1";
$maniahome = new Maniaplanet\WebServices\ManiaHome('jonthekiller|lottomania', '****', 'lottery');
echo "2";
$maniahome->postPersonalNotification($notification);
echo "finish";
?>
All solved now. The methods had confused me.gouxim wrote:You're doing "POST /maniahome/notification/public/" which is made for sending public notifcations (ie. a notification that will be seen by everyone that bookmark the Manialink" but you specify a receiverName in the object so it fails.
If you want instead to send a notification to someone that will be visible to all its buddies, use "POST /maniahome/notification/personal/" instead.
Can you try to add at the begining:jonthekiller wrote:With this script :
I can see start12 but not finish.Code: Select all
<?php echo "start"; require_once 'libraries/autoload.php'; $login = 'jonthekiller'; $notification = new Maniaplanet\WebServices\Notification(); $notification->receiverName = $login; $notification->link = 'lottery'; // can also be an URL, or a maniaplanet:/// link $notification->message = 'jonthekiller has bought a ticket on LottoMania'; // nickname will be prepended in that case $notification->iconStyle = 'ManiaPlanetLogos'; $notification->iconSubStyle = 'IconPlanetsPerspective'; echo "1"; $maniahome = new Maniaplanet\WebServices\ManiaHome('jonthekiller|lottomania', '****', 'lottery'); echo "2"; $maniahome->postPersonalNotification($notification); echo "finish"; ?>
My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
Code: Select all
error_reporting(E_ALL);
Code: Select all
$maniahome->postPersonalNotification($notification);
Code: Select all
try
{
$maniahome->postPersonalNotification($notification);
}
catch(\Exception $e)
{
var_dump($e);
}
I meant "a Manialink URL". I updated the Wiki page.fastforza wrote:Onto another problem: links do not work. ManiaHome attempts to send me to a Manialink (of the URL). On the wiki page you've explicitly documented it as 'can also be a URL'. I don't know if you meant a link to a manialink (file) or a link to a web page (browser).
Probably notfastforza wrote:If the latter is not available, could you look into implementing it?
Users browsing this forum: No registered users and 0 guests