Programmatically insert webform result I'm using drupal 6 with the webform module installed.

I need to be able to remotely POST, from PHP results to a webform. Pseudocode:

&lt;?php
//File: remote_script_not_hosted_on_the_same_server_as_drupal.php

$results = array(
'name' =&gt; 'testname',
'age' =&gt; '6',
);

$node = 5;

$url_to_drupal = 'http://remote_server.com/drupal-6.2';

insert_into_webform($results, $node, $url_to_drupal);


Of course, this example isn't perfect, but you (hopefully) get the idea.

How would you go about doing this?

I've opened an issue on the drupal queue: http://drupal.org/node/1082016

I'm concerned about these two fields invalidating my remote submission:

------WebKitFormBoundaryKIiNRZCPZIFlYWKc
Content-Disposition: form-data; name="form_build_id"

form-58f36748bfffd6752f204eadf1ba87c9
------WebKitFormBoundaryKIiNRZCPZIFlYWKc
Content-Disposition: form-data; name="form_token"

e4becb726ea858b6914980b9142b7f30
Have you tried using PHP to manually send the POST data? Here is a snippet from http://www.webmasterworld.com/php/3164561.htm

$server= 'www.someserver.com';
$url = '/path/to/webform/posturl';
$content = 'name1=value1&amp;name2=value2';
$content_length = strlen($content);
$headers= "POST $url HTTP/1.0\r\nContent-type: text/html\r\nHost: $server\r\nContent-length: $content_length\r\n\r\n";
$fp = fsockopen($server, $port, $errno, $errstr);
if (!$fp) {
    return false;
}
fputs($fp, $headers);
fputs($fp, $content);
$ret = "";
while (!feof($fp)) {
    $ret .= fgets($fp, 1024);
}
fclose($fp);
print $ret;


Of course this would fail if you are using any form of captcha on the form, and will also currently fail if you are required to be authenticated to post a reponse