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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?