I am using below post method for google account using curl but it gives me invalid_request error.
POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
Con
Why do you have CURLOPT_POST set to false?
curl_setopt($xml_do, CURLOPT_POST, false);
Although some configurations of cURL will automatically change this to tru if CURLOPT_POSTFIELDS is set, you do not have a valid postfield.
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. The filetype can be explicitly specified by following the filename with the type in the format ';type=mimetype'. This parameter can either be passed as a urlencoded string like 'para1=val1¶2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data. As of PHP 5.2.0, value must be an array if files are passed to this option with the @ prefix.
It should either be in param=value syntax or an array passed.