Here are two PHP scripts I just wrote that use
curl_setopt. The first example makes a GET request, and the second example makes a POST request, and passes JSON data to the web service it accesses.
A PHP curl GET request
This first one makes an HTTP GET request and prints the data that is returned by the URL that it hits: