dozoqn3347 2013-02-11 12:36
浏览 52
已采纳

MoonAPNS(是:从ASP.Net/C#中运行PHP脚本?)

I have a PHP script (taken from here) to send APNS notifications to an iOS app but the web services for the app are written in C#/ASP.Net.

I've managed to install PHP on the server and tested the script from the command line but don't know how to do this from within the web service (or even if this is possible).

Is there a way to run a PHP file from within ASP.Net or would I be better trying to re-write the PHP script in C#?

-EDIT- Some more searching turned up this, which prompted me to try the following code, without success:

public void PushNotificationAlert()
{
    string call = @"""php.exe""";
    string param1 = @"-f";
    string param2 = @"""~\APNS\myPush.php""";

    Process myProcess = new Process();
    ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(call);
    myProcessStartInfo.UseShellExecute = false;
    myProcessStartInfo.RedirectStandardOutput = true;
    myProcessStartInfo.Arguments = string.Format("{0} {1}", param1, param2);
    myProcess.StartInfo = myProcessStartInfo;

    myProcess.Start();
    StreamReader myStreamReader = myProcess.StandardOutput;
}
  • 写回答

1条回答 默认 最新

  • dongtuo5262 2013-02-15 11:45
    关注

    In case anyone is still interested, this is the code I used with Moon that eventually worked:

    // use MoonAPNS to send push notification
    NotificationPayload payload = new NotificationPayload(deviceToken, message, badge, "default");
    var notificationList = new List<NotificationPayload>() { payload };   
    PushNotification push = new PushNotification(true, p12file, p12pass);
    var result = push.SendToApple(notificationList);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发