try to put an absolute url instead of a relative one
Use RETURNTRANSFER if you want the results returned from the curl_exec() call
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
and use the handle $ch when calling curl_error()
$ret_val = curl_error($ch);