[英]how to growl from php
我正在嘗試從 PHP 發送咆哮通知。 接收計算機是 OSX,我能夠接收本地通知以及來自其他計算機執行的 ruby 腳本的通知。 沒有設置密碼。
我使用php-growl class,我的代碼如下所示:
<?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');
?>
我的腳本在本地注冊了咆哮,但沒有顯示任何通知。 我的日志文件中也找不到任何 PHP 錯誤。
關於如何在不使用密碼的情況下發送/接收咆哮的任何建議?
問題不在於使用空密碼。 在發送 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.');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.