如何从 php 咆哮

发布于 2024-11-14 17:42:47 字数 647 浏览 4 评论 0原文

我正在尝试从 PHP 发送咆哮通知。接收计算机是 OSX,我能够接收本地通知以及从其他计算机执行的 ruby​​ 脚本发出的通知。没有设置密码。

我使用 php-growl 类,我的代码如下所示:

<?php
    require 'class.growl.php';

    $ip_address = '10.0.0.210';

    $growl = new Growl($ip_address, '');

    // Register with the remote machine.
    // You only need to do this once.
    $growl -> register();

    // Send your message
    $growl -> notify('PHP Growl', 'Title', 'Here\'s the body text');
?>

我的脚本已在本地注册为growl ,但没有显示任何通知。我在日志文件中也找不到任何 PHP 错误。

关于如何在不使用密码的情况下发送/接收咆哮有什么建议吗?

I am trying to send growl notifications from PHP. The receiving computer is OSX and I am able to receive local notifications as well as notifications from ruby scripts executed from other computers. No password is set.

I use the php-growl class and my code looks like this:

<?php
    require 'class.growl.php';

    $ip_address = '10.0.0.210';

    $growl = new Growl($ip_address, '');

    // Register with the remote machine.
    // You only need to do this once.
    $growl -> register();

    // Send your message
    $growl -> notify('PHP Growl', 'Title', 'Here\'s the body text');
?>

My script was registered in growl locally, but no notification was displayed. I can't find any PHP errors in my log files either.

Any suggestions on how to send/receive growls without using a password?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一片旧的回忆 2024-11-21 17:42:47

问题不在于使用空密码。在发送 Growl 通知之前,您首先需要注册您计划发送的通知。

<?PHP
    $growl = new Growl($ip_address);

    // Adding and registering your notifications with Growl
    // only needs to be done once per computer. Growl will
    // remember your app after this.
    $growl->addNotification('Notification Name');
    $growl->addNotification('Another Notification');
    $growl->register();

    // Send a notification
    $growl->notify('Notification Name', 'Some Title', 'Some message to display');

    // Send a second notification
    $growl->notify('Another Notification', 'Another Title', 'Something useful I hope.');

The problem isn't using an empty password. Before you can send a Growl notification, you first need to register the notifications that you plan to send.

<?PHP
    $growl = new Growl($ip_address);

    // Adding and registering your notifications with Growl
    // only needs to be done once per computer. Growl will
    // remember your app after this.
    $growl->addNotification('Notification Name');
    $growl->addNotification('Another Notification');
    $growl->register();

    // Send a notification
    $growl->notify('Notification Name', 'Some Title', 'Some message to display');

    // Send a second notification
    $growl->notify('Another Notification', 'Another Title', 'Something useful I hope.');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文