使用PHP更新live tiles windows phone 8时出现有效负载错误
我在通过推送通知使用PHP更新live Tile时遇到问题。对于正常的Toast消息,没有任何错误。但是当我尝试使用相同的编码,并更改电话目标以及通知类时。我有一个有效载荷错误。这是我的源代码,不知道我是否做错了什么 谢谢使用PHP更新live tiles windows phone 8时出现有效负载错误,php,windows-phone-8,push-notification,mpns,Php,Windows Phone 8,Push Notification,Mpns,我在通过推送通知使用PHP更新live Tile时遇到问题。对于正常的Toast消息,没有任何错误。但是当我尝试使用相同的编码,并更改电话目标以及通知类时。我有一个有效载荷错误。这是我的源代码,不知道我是否做错了什么 谢谢 <?php if( isset($_POST['push_action']) && $_POST['push_action'] == "1") { $tileMessage = "<?xml version=\"1.0\" encodi
<?php
if( isset($_POST['push_action']) && $_POST['push_action'] == "1") {
$tileMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
"<wp:Notification xmlns:wp=\"WPNotification\">" .
"<wp:Tile>" .
"<wp:BackgroundImage>" . $_POST["push_msg0"] .
"</wp:BackgroundImage>" +
"<wp:Count>" . $_POST["push_msg1"] . "</wp:Count>" +
"<wp:Title>" . $_POST["push_msg2"] . "</wp:Title>" +
"<wp:BackBackgroundImage>" . $_POST["push_msg3"] . "</wp:BackBackgroundImage>" +
"<wp:BackTitle>" . $_POST["push_msg4"] . "</wp:BackTitle>" +
"<wp:BackContent>" . $_POST["push_msg5"] . "</wp:BackContent>" +
"</wp:Tile> " .
"</wp:Notification>";
// Create request to send
$r = curl_init();
curl_setopt($r, CURLOPT_URL, $_POST["push_uri"]);
curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($r, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
// add headers
$httpHeaders=array('Content-type: text/xml; charset=utf-8', 'X-WindowsPhone-Target: token',
'Accept: application/*', 'X-NotificationClass: 1','Content-Length:'.strlen($tileMessage));
curl_setopt($r, CURLOPT_HTTPHEADER, $httpHeaders);
// add message
curl_setopt($r, CURLOPT_POSTFIELDS, $tileMessage);
// execute request
$output = curl_exec($r);
curl_close($r);
}
?>
<form method="post" action="push2.php">
<h3>Push through php</h3>
<input type="text" name="push_uri" id="push_uri" placeholder="Push Uri" style="width:50%;padding:5px;" autofocus required/> <br><br>
<input type="text" name="push_msg0" id="push_msg0" placeholder="Background Image" style="width:50%;padding:5px;" required/> <br><br>
<input type="text" name="push_msg1" id="push_msg1" placeholder="Count" style="width:50%;padding:5px;" required/> <br><br>
<input type="text" name="push_msg2" id="push_msg2" placeholder="Title" style="width:50%;padding:5px;" required/> <br><br>
<input type="text" name="push_msg3" id="push_msg3" placeholder="Back Background Image" style="width:50%;padding:5px;" required/> <br><br>
<input type="text" name="push_msg4" id="push_msg4" placeholder="Back Title" style="width:50%;padding:5px;" required/> <br><br>
<input type="text" name="push_msg5" id="push_msg5" placeholder="Back Content" style="width:50%;padding:5px;" required/> <br><br>
<input type="hidden" name="push_action" value="1" />
<input type="submit" value="Push" style="width:50%;padding:5px;"/>
推送php
显然,我遗漏了导致它无法工作的版本=2.0、磁贴ID和磁贴模板。这是这两行的更新版本,之后我可以通过推送通知来更新磁贴
"<wp:Notification xmlns:wp=\"WPNotification\" Version=\"2.0\">"
"<wp:Tile Id=\"/MainPage.xaml?Name=flip\" Template=\"FlipTile\">"
“”
""
你能把你得到的全部错误文本放进去吗?您发送的某些值似乎无效。客户端应用程序有什么类型的磁贴(图标、翻转)?您是否检查了这个类似的问题@stipe我收到的错误消息是“”,XML负载包含无效或格式不正确的XML,或者在标头中指定的通知类型与使用的负载类型不匹配。频道已经关闭了。检查您的XML负载是否存在错误,然后重新打开频道以获取新的URI。“我正在尝试更新flip tiles。不是图标。谢谢。”