Command line Curl to Php curl code problem

Command line Curl which is working properly is :

curl --data username=ekansh&domain=siteURL&password=mypass
http://siteURL:8090/add-user -k -v -u apiuser:XXXXXXX

And i have tried below code for convert it in PHP CURL CODE:

$fields = array(‘domain’ => ‘SiteUrl:8090’,‘password’ => ‘mypass’,‘username’ => ‘Ekansh’);

$data=array(CURLOPT_POST => 1,CURLOPT_HEADER => 0,CURLOPT_URL =>
'SiteUrl:8090/add-user ',CURLOPT_FRESH_CONNECT => 1,CURLOPT_RETURNTRANSFER => 1,CURLOPT_FORBID_REUSE =>
1,CURLOPT_TIMEOUT => 4,CURLOPT_POSTFIELDS => $fields,CURLOPT_SSL_VERIFYPEER => FALSE,CURLOPT_USERPWD => ‘apiuser:XXXXXXX’,CURLOPT_VERBOSE=>TRUE);

$ch = curl_init();
curl_setopt_array($ch,$data);
$result=curl_exec($ch);
curl_close($ch);

But above code is not working. what i am done wrong in code?

  1. Consider adding some [PHP ][/PHP ] tags around the code in your question to make it a bit easier to read.
  2. Is it generating an error? Not returning? Returning the wrong values? A hint might be useful.
  3. Make a simple curl php script that just downloads a site or something. This will help to verify if you have curl extension loaded. You can also check phpinfo.

Whats the $result variable look like? Also, echo out curl_error (http://php.net/manual/en/function.curl-error.php)