0

Can anyone offer some direction on how to achieve a programmatic POST request?

I have developed a module which needs to send data to an external URL as part of it's functionality.

To achieve that, I am using the following code:

drupal_goto("https://external.secure.co.uk", array(
                'query' => array(
                    'nid'=>$submission->nid, 
                    'sid'=>$submission->sid
                ),
            ));

This works successfully and redirects my users to the following url:

https://external.secure.co.uk?nid=271&sid=57

The only issue is my data is sent as a GET request. For security reasons I need to find a solution which will allow me to send the data in a POST request.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
sisko
  • 9,604
  • 20
  • 67
  • 139

1 Answers1

1

Take a look at [drupal_http_request]: http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_http_request/7

Hans N. Hjort
  • 851
  • 7
  • 19