Post data to url using AppleScript
I am trying to take user input and send the data to a url on my site to do some checks against my database. In my php script I cant display any of the POST variables. it seems like the data is not being sent. I am new to AppleScript so perhaps I am not doing this correctly?
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;
}
?>
Solution 1:
While I cannot throughly test your issue, because I don't have access to your site, nonetheless, the following line of code is malformed:
set theURL to "http://mysite/testing.php?email=email&productKey=productKey"
It should be in the form of:
set theURL to "http://mysite/testing.php?email=" & email & "&productKey=" & productKey