I just thought this was kinda strange... the very first article on the
front page of the PHP Developer Center compares using curl vs
file_get_contents for REST requests. It states that file_get_contents
is simple but doesn't work for POSTs, which is incorrect for PHP > 5.
You can use the context parameter to do a POST using file_get_contents.
$context_options['http']['method'] = 'POST';
$context_options['http']['header'] = $header; // "POST $uri
HTTP/1.0rnContent-Length: $content_lengthrnrn"
$context_options['http']['content'] = $post_content;
$context = stream_context_create($context_options);
$response = file_get_contents($filename, false, $context);
source article: http://developer.yahoo.com/php/howto-reqRestPhp.html
.