Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Using POST method from AppleScript

Using POST method from AppleScript
Thread Tools
Dedicated MacNNer
Join Date: Feb 2001
Location: Huddersfield, UK
Status: Offline
Reply With Quote
Jun 16, 2002, 08:13 AM
 
This is the challenge that I decided to undertake today: To write an AppleScript that will send my IP address to my mobile phone in an SMS message.

Anyhow... I have a free SMS messaging service from my ISP (<a href="http://www.tiscali.co.uk/login/index.php?url=/commscentre/sms/form.php" target="_blank">Tiscali</a>)and this uses a series of forms made by PHP to: </font></li>[*]<font size="1" face="Geneva, Verdana, Arial, sans-serif">a) login</font></li>[*]<font size="1" face="Geneva, Verdana, Arial, sans-serif">b) enter the mobile number and text message and</font></li>[*]<font size="1" face="Geneva, Verdana, Arial, sans-serif">c) confirm the sending of the text message

Now this got me a bit stuck because all of these forms use the POST method (form action="foo" method="POST") and I don't know how to send my details to the server in order to send the text message.

I figured that if it used the (more insecure) GET method, I could just use: "open location target_URL" where target_URL includes the data pairs after the "/login.php?"

However, this is not the case. I've looked in the URL access scripting dictionary and the closest thing I've found to what I'm looking for is this:

download string form data string

Could someone please provide some pointers on how to send data to a PHP script using the POST method (websites, sample code etc. would be appreciated)

Thanks for your time,
Richard
PM G4 DP 500 MHz, 768 Mb, DVD-ROM, 85 Gb, Mac OS X 10.3.9
PB G4 1.25 GHz, 512 Mb, DVD-R, 80 Gb, Mac OS X 10.4
     
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Jun 16, 2002, 09:22 AM
 
I would use the command-line curl program.

Do a man curl to learn about all of its (myriad and thorough) options, including doing a POST.

If you just want your IP address, what about using a free dynamic DNS service like <a href="http://www.dyndns.org" target="_blank">http://www.dyndns.org</a> ?
     
Richyfp  (op)
Dedicated MacNNer
Join Date: Feb 2001
Location: Huddersfield, UK
Status: Offline
Reply With Quote
Jun 16, 2002, 09:38 AM
 
Thanks for the heads-up! I'll read through the (very extensive) man pages...

I would use DynDNS, but a) I thought that they stopped accepting new customers and b) This is a challenge that I would very much like to undertake!

Thanks again,
Richard
PM G4 DP 500 MHz, 768 Mb, DVD-ROM, 85 Gb, Mac OS X 10.3.9
PB G4 1.25 GHz, 512 Mb, DVD-R, 80 Gb, Mac OS X 10.4
     
Mac Elite
Join Date: Jan 2001
Location: New York
Status: Offline
Reply With Quote
Jun 16, 2002, 05:21 PM
 
(Off Topic) I'm not a big fan of having to use an NSTask via CURL to do a post. Anyone have a simpler way in cocoa (Objective-C not Applescript Studio).
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2