dtntjwkl83750 2012-09-14 14:43
浏览 111
已采纳

在AppleScript中调用php脚本

I want to call an external php script with applescript and alfred. Currently I open the Safari with the url to the php script. This is very annoying. Is there a way to call the php script without open the Safari?

Best regards, emha

  • 写回答

1条回答 默认 最新

  • dpwbc42604 2012-09-14 14:45
    关注

    PHP scripts / commands can be ran from a standard shell prompt:

    do shell script "php -q " & quoted form of posix path of phpScriptPath
    

    Source: here

    EDIT:

    You can use cURL from the shell, and dump the output. This is kind of like just pinging your script, which I'm guessing is what you want to do. Just replace http://www.google.com with the path to your script. And if you omit >/dev/null 2>&1, you can get cURL's output. This is nice because you can add flags to curl to show headers, do post / get, etc.

    do shell script "curl http://www.google.com >/dev/null 2>&1"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 怎么实现只排序每行中的第二列的数 如果比两数都大就放在第三列中 比两数都小就放在第一列中(语言-c语言)
  • ¥15 应用商店如何检测在架应用内容是否违规?
  • ¥15 Ubuntu系统配置PX4
  • ¥20 MATLAB间接平差计算
  • ¥50 nw.js调用activex
  • ¥15 数据库获取信息反馈出错,直接查询了ref字段并且还使用了User文档的_id而不是自己的
  • ¥15 将安全信息用到以下对象时发生以下错误:c:dumpstack.log.tmp 另一个程序正在使用此文件,因此无法访问
  • ¥15 速度位置规划实现精确定位的问题
  • ¥15 MAC虚拟机(win11)USB插上后无串口com,无法烧录
  • ¥15 代码问题:df = pd.read_excel('c:\User\18343\Desktop\wpsdata.xlxs')路径读不到