RE: [PHP] auto form submit
| From: | JSheble | Date: | Wed, 21 Nov 2001 00:54:30 +0000 |
| Subject: | RE: [PHP] auto form submit | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75333@lists.php.net to get a copy of this message | ||
When POST data is sent to a page, it's as if somebody typed the text into a
textarea and hit a submit button. Even though this is being done
programmatically, the POST method will behave the same. SOmebody in their
(your)code will have to write something similiar to:
$postData = "xVar=" . rawurlencode( "<?xml version=\"1.0\"><sometag
value=\"some value\"></xml>" );
PostToHost( "http://www.domain.com" "/phpfile.php", $postData );
then your script would access that XML data through the
HTTP_POST_VARS['xVar'] or $xVar as normal
/* not my function, found on some PHP site */
function PostToHost( $host, $path, $data_to_send ) {
$cRetVal = "";
$fp = fsockopen( $host, 80 );
fputs( $fp, "POST $path HTTP/1.1\n" );
fputs( $fp, "Host: $host\n" );
fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
fputs( $fp, "Content-length: " . strlen($data_to_send) . "\n" );
fputs( $fp, "Connection: close\n\n" );
fputs( $fp, $data_to_send );
while( !feof( $fp )) {
$cRetVal .= fgets( $fp, 128 );
}
fclose( $fp );
return $cRetVal;
}
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netXML file is text file. If I open the file with php like call $fp, that is a long string with some special char. post method can send a long string to the server. how php can receive that long string is my problem. if can do that, php can parser the xml file send form remote computer. I want php parser the SOAP message -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:sunhe@bj.tom.com Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <johan@1way2print.net> wrote in message news:20011115090950.79658.qmail@pb1.pair.com...-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.netI think you understand my problem. I will use a client program to POST the XML data to a php file on the server base HTTP in php file will get the post request, the question is, how can i get the xml data in post requestHmm, I dont think I understand? Where do you want to do with the XML? Cant you just make a echo() in a xml document? please explain? <?xml version='1.0'?> ... ... .... <?php echo $xmldatavar; ?> ... ... ... Regards, Johan