I am having issues sending a POST via my module.
In my browser's REST client I get a 200 with
POST https://mydomain.com
username=myuser&password=password1
So I know that the service is working fine. I tried to replicate this call in my Drupal module with
$url = "https://mydomain.com";
$data = array(
'username' => 'myuser',
'password' => 'password1',
);
$data = http_build_query($data, '', '&');
$options = array(
'method' => 'POST',
'data' => $data
);
$response = drupal_http_request($url, $options);
The response I get is a 400. according to this I am not constructing the request correctly.
Question: How should I change my code in order to get a 200?
Note: I am using Drupal 7.
Thanks.