• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to do an HTTP POST?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do an HTTP POST?


  • Subject: Re: How to do an HTTP POST?
  • From: Rob <email@hidden>
  • Date: Sun, 29 Sep 2002 08:54:30 -0700

> I've seen the emails recently about how to do an HTTP "GET" or "Download"
> command using URL Access scripting. I have a need to do a POST via HTTP
> through post 80 - - - - can someone show me how that's done? I don't think
> it would be the "upload" command within URL Access scripting, as it appears
> to be related to uploading files. Is there another HTTP OSAX command-set
> that handles HTTP POST?
>
> As an example, I'm trying to configure a DSL router via Applescript. The
> cgi I'm referencing is:
>
> http://10.0.0.138/cgi/ispname/SetPPPeEUserInfo.cgi
>
> as the URL, and then I need to POST these parameters:
>
> userid=usernamevariable1 passwd=userpassword1
>
> I'm at a bit of a loss as to how to do this POST via Applescript. Any
> assistance is greatly appreciated.


The following test script is a POST example. It should respond with your
parameters (see form_data). Hope this helps. Tested with 0S 9.2.2

Rob


-- start of script
set the action_URL to "http://www.cc.ukans.edu/cgi-bin/pq.pl";
-- the above cgi sends back your form data arguments, good for testing!

set the form_data to "userid=usernamevariable1&passwd=userpassword1"

set the query_results_file to (path to desktop folder as text) & "My Results
File"

try
with timeout of 20 seconds -- try connecting for 1 minute
tell application "URL Access Scripting"
download the action_URL to file ,
the query_results_file form data form_data replacing yes
with progress
quit
end tell
end timeout
tell application "Finder"

set the file type of the file query_results_file to "TEXT"
set the creator type of the file query_results_file to "MSIE"
open the file query_results_file

end tell
on error the error_message number error_number
tell application "URL Access Scripting" to quit

if the error_number is not -128 then
tell application (path to frontmost application as text)
beep
display dialog the error_message buttons {"Cancel"} default
button 1
end tell
end if
end try
-- end of script
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Funny (obscure) 'using terms from' usage
  • Next by Date: Re: Funny (obscure) 'using terms from' usage
  • Previous by thread: Re: How to do an HTTP POST?
  • Next by thread: Re : Is SMILE the way to go for this?
  • Index(es):
    • Date
    • Thread