Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php的平铺通知_Php_Windows Phone 7_Push Notification_Mpns - Fatal编程技术网

使用php的平铺通知

使用php的平铺通知,php,windows-phone-7,push-notification,mpns,Php,Windows Phone 7,Push Notification,Mpns,我正在尝试使用此库向手机发送磁贴通知 但只有当我输入远程图像的URL时,手机才会收到通知。这是我的简单php代码 $uri="http://db3.notify.live.net/throttledthirdparty/01.00/AAEyQ7xxxxxxxxxxx"; $notif=new WindowsPhonePushNotification($uri); $imm="http://www.mysite.net/imm/1.jpg"; $notif->push_tile($im

我正在尝试使用此库向手机发送磁贴通知 但只有当我输入远程图像的URL时,手机才会收到通知。这是我的简单php代码

$uri="http://db3.notify.live.net/throttledthirdparty/01.00/AAEyQ7xxxxxxxxxxx";

$notif=new WindowsPhonePushNotification($uri);

$imm="http://www.mysite.net/imm/1.jpg";

$notif->push_tile($imm, "Title","2");
这是c代码

私有HttpNotificationChannel;
公共主页()
{
初始化组件();
尝试
{
StartChannel();
}
捕获(无效操作异常ioe)
{
HandleChannel异常(ioe);
}
}
私有无效HandleChannel异常(InvalidOperationException ioe)
{
MessageBox.Show(ioe.Message);
}
专用void StartChannel()
{
channel=HttpNotificationChannel.Find(“test1”);
如果(通道==null)
{
通道=新的HttpNotificationChannel(“test1”,“name”);
添加代理();
通道打开();
}
其他的
{
添加代理();
}
if(channel.ChannelUri!=null)
{
OnChannelReady();
}
}
私有void AddDelegates()
{
channel.ChannelUriUpdated+=新的事件处理程序(channel\u ChannelUriUpdated);
channel.ErrorOccessed+=新事件处理程序(channel_ErrorOccessed);
channel.HttpNotificationReceived+=新事件处理程序(channel_HttpNotificationReceived);
}
私有无效通道\u HttpNotificationReceived(对象发送方,HttpNotificationEventArgs e)
{
StreamReader sr=新的StreamReader(e.Notification.Body,Encoding.UTF8);
string text=sr.ReadToEnd();
this.Dispatcher.BeginInvoke(()=>MessageBox.Show(text));
}
发生私有无效通道错误(对象发送方,NotificationChannelErrorEventArgs e)
{
MessageBox.Show(“错误”);
}
私有无效通道\u ChannelUriUpdated(对象发送方,NotificationChannelUriEventArgs e)
{
尝试
{
this.Dispatcher.BeginInvoke(OnChannelReady);
}
捕获(无效操作异常ioe)
{
this.Dispatcher.BeginInvoke(()=>HandleChannel异常(ioe));
}
}
私有void OnChannelReady()
{
如果(!this.channel.IsShellTileBound)
this.channel.BindToShellTile();
}
这是一个日志文件:

* About to connect() to db3.notify.live.net port 80
*   Trying xx.xx.xx.xxx... * connected
* Connected to db3.notify.live.net (xxx.xx.xx.xxx) port 80
> POST /throttledthirdparty/01.00/AAE0ykxoIaknSoMXxxxxxxxxxxxx HTTP/1.1
Host: db3.notify.live.net
Accept: */*
X-WindowsPhone-Target: token
X-NotificationClass: 1
Content-Length: 240
Content-Type: application/x-www-form-urlencoded
<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
<wp:Tile>
<wp:BackgroundImage>http://www.mysite.net/imm/1.jpg</wp:BackgroundImage>
<wp:Count>2</wp:Count>
<wp:Title>6</wp:Title>
</wp:Tile> 
</wp:Notification>< HTTP/1.1 200 OK
< Cache-Control: private
< Server: Microsoft-IIS/7.5
< X-DeviceConnectionStatus: Connected
< X-NotificationStatus: Received
< X-SubscriptionStatus: Active
< X-MessageID: 00000000-0000-0000-0000-000000000000
< ActivityId: xxxxxx-83fa-423d-8240-ec610eca749b
< X-Server: DB3MPNSM005
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 07 Jun 2011 11:57:18 GMT
< Content-Length: 0
* Connection #0 to host db3.notify.live.net left intact
* Closing connection #0
*即将()连接到db3.notify.live.net端口80
*正在尝试xx.xx.xx.xxx…*有联系的
*已连接到db3.notify.live.net(xxx.xx.xx.xxx)端口80
>邮政/节流第三方/01.00/AAE0YKXOIAKNSOMXXXXXXXXXXXXXX HTTP/1.1
主机:db3.notify.live.net
接受:*/*
X-WindowsPhone-Target:令牌
X-通知类:1
内容长度:240
内容类型:application/x-www-form-urlencoded
http://www.mysite.net/imm/1.jpg
2.
6.
好的,这将教会我仔细查看代码-如果您调用BindToShellTile()而不带参数,则只能使用本地资源进行互动程序。但是,如果创建新集合并将该集合作为参数传入,则可以访问互动程序中的本地或远程图像

例如

Collection TileLocations=newcollection{newuri(@)/Background.jpg”)};
添加(新Uri(“http://jquery.andreaseberhard.de"));
如果(!channel.IsShellTileBound){channel.BindToShellTile(TileLocations);}
我们应该做到这一点。URI集合应该包含可以从中检索图像的所有可能域。在这种情况下,任何位置的图像都是有效的图像。详情请参阅


现在调用
$notif->push_u>tile(“http://jquery.andreaseberhard.de/pngFix/pngtest.png“,”标题“,”2“应可用于远程映像。

是否可用于远程映像?(我不清楚你的问题)不要处理远程图像。它应该只处理远程图像。您正在输入它正在使用的内容?你能在设备上查看internet explorer的远程图像吗?是的,我能在设备上查看ie的远程图像…谢谢!你好我的图像有以下规格:100x100px,大小8,08KB。我已经添加了一个日志文件…好的,它应该没有什么区别,但是你的平铺图像应该是173 x 173像素…用我自己测试的一些结果更新了我的答案。远程图像也不适合我,因为某些原因,我得到了一个适合我的局部修复。现在,它似乎已经达到了平台允许的程度,我想这是必须做到的。
* About to connect() to db3.notify.live.net port 80
*   Trying xx.xx.xx.xxx... * connected
* Connected to db3.notify.live.net (xxx.xx.xx.xxx) port 80
> POST /throttledthirdparty/01.00/AAE0ykxoIaknSoMXxxxxxxxxxxxx HTTP/1.1
Host: db3.notify.live.net
Accept: */*
X-WindowsPhone-Target: token
X-NotificationClass: 1
Content-Length: 240
Content-Type: application/x-www-form-urlencoded
<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
<wp:Tile>
<wp:BackgroundImage>http://www.mysite.net/imm/1.jpg</wp:BackgroundImage>
<wp:Count>2</wp:Count>
<wp:Title>6</wp:Title>
</wp:Tile> 
</wp:Notification>< HTTP/1.1 200 OK
< Cache-Control: private
< Server: Microsoft-IIS/7.5
< X-DeviceConnectionStatus: Connected
< X-NotificationStatus: Received
< X-SubscriptionStatus: Active
< X-MessageID: 00000000-0000-0000-0000-000000000000
< ActivityId: xxxxxx-83fa-423d-8240-ec610eca749b
< X-Server: DB3MPNSM005
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 07 Jun 2011 11:57:18 GMT
< Content-Length: 0
* Connection #0 to host db3.notify.live.net left intact
* Closing connection #0
Collection<Uri> TileLocations = new Collection<Uri> { new Uri(@"/Background.jpg") };
TileLocations.Add(new Uri("http://jquery.andreaseberhard.de"));
if (!channel.IsShellTileBound) { channel.BindToShellTile(TileLocations); }