• 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: URL Access Scripting- post data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: URL Access Scripting- post data


  • Subject: Re: URL Access Scripting- post data
  • From: "Daniel A. Shockley" <email@hidden>
  • Date: Tue, 15 Oct 2002 19:10:57 -0400

Hmm. I haven't read the list for a while, but noticed this sad thread. Actually, URL Access Scripting has not been able to 'post data' in any version of Mac OS X 10.1, and perhaps even earlier versions as well. It seems that my copy of Jaguar manages to launch the Classic version of UAS, and it even seems to work. I just curl, instead, though, since it is very reliable and fast. It's a very powerful command-line download utility, built into Mac OS X 10.1 and higher. To read more about curl's features, type man curl in Terminal.app.

Here's a quick sample that uses a sample post-processing CGI and saves the results to a file named somefile.html on your desktop. It's much faster, but you don't get the 'unpacking' or 'with progress' features of UAS:

set downloadURL to "http://www.idocs.com/cgi-bin/mycgi.pl";

set theFormInfo to "realname=George the Wonder Boy&email=email@hidden&" & ,
"nosmoke=on&myself=Here's my little bio about myself."

set destExpected to (path to desktop as string) & "somefile.html"

try
set curlCode to "curl \"" & downloadURL & "\""

set unixDestExpected to POSIX path of (destExpected as string)
set curlCode to curlCode & " --output \"" & unixDestExpected & "\""

if (length of theFormInfo) > 0 then
set hasFormInfo to true
else
set hasFormInfo to false
end if

if hasFormInfo then
set curlCode to curlCode & " -d \"" & theFormInfo & "\""
end if

set curlResponse to do shell script curlCode

on error errMsg number errNum
error "Could not download " & downloadURL & " (using 'curl') due to the following error: " & errMsg
end try




Message: 3
Date: Sun, 6 Oct 2002 23:14:06 +0200
Subject: URL Access Scripting- post data
From: email@hidden (Gerd)
To: email@hidden

Hallo Marc, Hallo Rob,

thanks for your help.

1. question:
I tried as you suggested (OS X 10.1.5):

set myFolderRef to ((path to startup disk) as string) & ":Festplatte"

and got the error:
Can't make alias . Can't make some object into a <<handler run>> .


2. question
If i try to run the script this way i still get following error:
Application is not running.
The whole line 'download the action ... ' is highlighted .
Before i choose the UAS when i was asked 'where is UAS ?' .
(I put away the old OS 9 UAS) When i twas there, the sript always loaded
only the OS 9 UAS .

set the action_URL to "http://hotornot.whow.de/user.php?action=index.php";

set the form_data to
"previmg_wertung=10&previd=244235&state=wertung&redir=nein"

set the query_results_file to "Festplatte:" & "FMData"

with timeout of 100 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
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
end timeout

Any ideas

Gerd


--
----
Daniel A. Shockley
email@hidden
email@hidden
http://www.danshockley.com
_______________________________________________
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: Re: QuickTime Player Scripting
  • Next by Date: help printing from quark 4.0
  • Previous by thread: URL Access Scripting- post data
  • Next by thread: URL Access Scripting- post data
  • Index(es):
    • Date
    • Thread