Is it possible to send a web form using applescript? I have a site “www.fishinthe.net/forums” that runs searches on it’s forum by sending a form, and then showing the results. Most searches are easy to script, because the search term is part of the url, but I have NO clue how to work with this. Anyway, thanks!
-------EDIT-------
Okay, looking at the source of the page, the place I need to send the text to is:
The bit of html you posted above isn’t actually going to get you very far. That is probably the text field in the page that you type your query into, but it’s likely not all of what you need. In the html source code, will be a block of code inside some form tags… i.e. . Any tags inside the form block that are “” or “” are probably important, and are what makes up the whole search query. The url in the “action” property of the form tag is the url you need to send your query to.
The trick here, is telling us what exactly you intend to do with the results? Are you displaying the page in a web view, or are you going to try to parse the resulting source page into meaningful data? If all you want to do is launch the page in a browser, then all you need is to create a small script that uses “open location…” to launch your query using the system default browser. If you want to view it in your app, then use a web view. If you want to get the raw data of the source html displayed after the query is sent and try to do some fancy parsing on it, then you probably want to use “curl”. curl is a command line tool that allows you to fetch and send urls to servers. You can use “do shell script” to execute the curl command once you’ve formed it.
If you decide you want to use curl…
The easiest thing would be for the web site to run it’s search using the “get” method. The get method sends the search query to the server script in a url. An example would be the link above. It’s got a long string of variables that the server may or may not be expecting as part of the request. To find out if your server uses get, go to it and do a search. If the url in the location bar when you hit the search button is full of key/value pairs, then you’re probably using get. If you’re not using get, then you’re using “post”. Post sends the query to the server behind the scenes, and does not send the query in the url. You can still easily use curl to send a post request, you just have to change the syntax a bit. If you’re trying to search a private site or one with some extended security, there may also be other considerations.