Do not urlencode the entire URL. Instead, just the values of the query string variables, e.g.:
$url = sprintf(
'http://www.example.com/webservice.php?var1=%s&var2=%s',
urlencode($value1),
urlencode($value2)
);
Or, if you don't like using sprintf():
$url = 'http://www.example.com/webservice.php?var1=' .
urlencode($value1) . '&var2=' . urlencode($value2);