drupal http_request give solr parse exception typing a WS uri into the navigator return the json correctly 

but the same adress in $url

 $result=drupal_http_request( $url );
 var_dump($result-&gt;data);


gives a parse exception


  Cannot parse 'docid:(7000': Encountered \"\" at line 1, column
  11.\nWas expecting one of:\n ...\n ...\n ...\n \"+\" ...\n \"-\" ...\n ...\n \"(\" ...\n \")\" ...\n \"*\" ...\n \"^\" ...\n ...\n ...\n
  ...\n ...\n ...\n ...\n \"[\" ...\n \"{\" ...\n ...\n \"filter(\"
  ...\n ...\n ","code":400}


it must have smthg to do with whitespace or some special characters 
because it works with docid:(7000) but not docid:(7000 OR 7001)

How to somehow encode the url so that the solr WS server is happy with my request? 

the same url works with drupal 8 code

   use GuzzleHttp\Client;
      $client = new Client();
      $response = $client-&gt;request('GET', $url);
i found out I have had to urlencode the bracket part of my url for it to work

urlencode('(7000 OR 7001)'