Why does my curl command fail when run through applescript but work fine when I run directly in a terminal?

While

http://192.168.0.103/cgi-bin/proj_ctl.cgi?key=shutter_on&lang=e&osd=on

works fine in a browser, it does not in a shell.

To resolve the issue you need to quote the URL.

In set curlScript to ... change theUrl to either theUrl's quoted form or: quoted form of theUrl