dpicx06888 2015-09-20 05:42
浏览 29
已采纳

如何在php中设置发布请求的Web服务[重复]

I am setting up Safari push notifications and they send a response to a endpoint that they choose.

I need to set up a web service backend to account for this.

They POST a token to:

/v1/devices/<deviceToken>/registrations/<websitePushId>

How do I set up my backend, using rewrites, or something... to capture the deviceToken and websitePushId?

I have a php script to add this info to a database. I just don't know how to get the POST info, and those two parameters into that script.

Any ideas?

</div>
  • 写回答

1条回答 默认 最新

  • douzhengzuo7283 2015-09-20 06:14
    关注

    OK. So it actually isn't that difficult when I got the right syntax.

    If anyone wants to know in the future. This is how you can do it.

    RewriteRule ^v1/pushPackages/(.*?)$ /API/SafariNotifications/$1/v1/pushPackages/createPushPackage.php [L]
    
    RewriteRule ^v1/devices/(.*?)/registrations/(.*?)$ /API/SafariNotifications/$2/v1/devices/registerUsers.php?deviceToken=$1 [L]
    
    RewriteRule ^v1/log$ /API/SafariNotifications/log/log.php [L]
    

    Then in those php files, you can write your magic and return what you need to return.

    In the device token rewrite. it will actually POST through the data, as well as add the GET param. So you can access both in your file.

    This is for setting up Safari Push Notifications Web Service Back End.

    Hope this can help someone in the future.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机数字电压表电路组成及框图
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line