cURL Question. Search Queries within Websites w/ Static URLs

So far, I’ve been using the cURL shell command to help me retrieve info from the type of websites like whitepages and google where you input some data and the site returns results based on your data (like putting in a phone number and getting the city/state for the area code). All these websites so far put my search query in the URL after I input the data

                 example: whitepages.com/search/ReversePhone?full_phone=9098874323,  where 9098874323 is the phone number entered in the search.

But there are some websites that don’t show you the search query in the URL when you enter some data. For example, ip-adress.com (mispelled on purpose) is a really awesome, accurate IP address lookup (relatively speaking). But when you enter an IP address, it doesn’t show you that search query in the URL when loading up the results.

So my question: is there still a way to access these search queries within websites that don’t display the search parameters in the URL?

Thought I’d ask before I drove myself crazy spending my days and nights trying to figure this out.

You’ll probably have to make use of curl’s --form or --data options…

Thank you Bruce, that helped lead me in the right direction. Did a little research on posting forms and curl and found a solution.

For reference, in case anyone’s curious, here’s the script that worked:

property address : "http://www.ip-adress.com"
set ipAddy to "IP ADDRESS HERE"
do shell script "curl -F \"QRY=" & ipAddy & "\" " & address

Edit: edited out my ip-address, I don’t trust all of you here :slight_smile:

ok, turns out my code only returns back my ip address. when you go to ip-adress.com, it automatically loads up your ip address info, so my script isn’t really entering any data in the forms. Any suggestions on what went wrong? I saw some guy was able to do this with php and I have a text file of his code, but I don’t know how to transfer that from php to Applescript. If it’ll help, i could post that.

Have you seen this? click me!

no, I haven’t seen this. How does this work exactly? it looks like it’s a script for a particular program that fills in forms on the web … if so, how do I get that program?

It looks like 2 applescripts to me, not a program.

I don’t have experience with what you are trying to do, but by looking at that post it seems t be saying that there’s 2 different methods of posting web data, by the “get” method and by the “post” method. The first 3 lines look like an applescript for the “post” method and the last line looks like an applescript for the “get” method. I would think in your situation you should try the first 3 lines. Var1 and Var2 look like your search parameters. remoteApp looks like the wesite URL. I thought you might give it a try. I don’t know if it will work but it’s only 3 lines of code.