Can anyone convert this curl command that works in command line to php code :
$ curl -u [email protected] -X POST -d "" https://build.phonegap.com/token
I tried this code but didnt work :
$target_url = "https://[email protected]:[email protected]/token"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST,1);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result;
When I am executing the above code , I am getting the error :
301 Moved
The document has moved here(link to gmail.com).
But, if i use the command in command line, it is working fine . Where am i wrong ?
Also, please tell me what does that "-X" mean, and how can convert it to php code ?
Thanks