Correct semantic errors in RestfulService

cURL options are numeric, and array_merge is destructive of numeric
keys. Replace array_merge calls with array union operator, with defaults
on right-hand side so that passed options override defaults.

$curlError was used only once and never defined. Replace $curlError with
a call to curl_error($ch).