使用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
标签:php,http,applescript 来源: https://codeday.me/bug/20190818/1688846.html