How to - input data and forwarding it?

Hello everybody!

How do I do this, as simple as possible…

  1. ask the user a number X
  2. fetch some data thru the web by
    set Y to do shell script “/usr/bin/curl http://www.zzz.com.php?var=X

Especially, how do I include this X on this second line?

I hope this is trivail :stuck_out_tongue: Thanks in advance!

Hello,

try something like…


repeat
	set my_number to text returned of (display dialog "Please enter some number..." default answer "123" with title "Request" buttons {"Cancel", "OK"} default button 2 with icon 1)
	if my_number ≠ "" then
		try
			set my_number to my_number as number
			--get the absolute value
			if my_number is less than 0 then
				set my_number to -my_number
			end if
			exit repeat
		end try
	end if
end repeat

do shell script "/usr/bin/curl " & quoted form of ("http://www.zzz.com.php?var=" & my_number)

Hello!

Ok, that was good one. Thank.
How should I do this:

I want to

set Y to do shell script "/usr/bin/curl [url=http://www.zzz.com/test.php?id=xxx]http://www.zzz.com/test.php?id=xxx"[/url]

but if the xxx is in a variable named calc then how should I merge? Like this?

set Y to do shell script "/usr/bin/curl [url=http://www.zzz.com/test.php?id=]http://www.zzz.com/test.php?id="[/url] + calc

Or what? I really do not know :rolleyes: all advice are welcome!

almost.

+ is an mathematical operator
& is the operator to concatenate text, lists or records

set Y to do shell script "/usr/bin/curl [url=http://www.zzz.com/test.php?id=]http://www.zzz.com/test.php?id="[/url] & calc

Thanks again, super!
This way I can now receive and transmit data to remote server. Super!