微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用AppleScript将数据发布到网址

我试图获取用户输入并将数据发送到我的网站上的网址,以对我的数据库进行一些检查.在我的PHP脚本中,我无法显示任何POST变量.好像没有发送数据.我是AppleScript的新手,所以也许我没有正确地做到这一点?

AppleScript的:

set email to the text returned of (display dialog "Enter in your Email:" default answer "")

set productKey to the text returned of (display dialog "Enter in your Product Key:" default answer "")

display dialog "Email: " & email & "
Product Key: " & productKey

set theURL to "http://mysite/testing.PHP?email=email&productKey=productKey"
do shell script "curl " & quoted form of theURL

PHP

<?PHP
echo "made it before post";


    if (!empty($_POST))
    {
        $email  = $_POST["email"];
        $productKey = $_POST["productKey"];
        echo "Made it here";
        echo $email;
        echo $productKey;
    }
?>

解决方法:

虽然我无法彻底测试您的问题,但由于我无法访问您的网站,但以下代码行格式不正确:

set theURL to "http://mysite/testing.PHP?email=email&productKey=productKey"

它应该是以下形式:

set theURL to "http://mysite/testing.PHP?email=" & email & "&productKey=" & productKey

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐