RE: [PHP] Re: how can I get the post content in php
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( "" ); 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; } > > XML 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:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ > > ID:yorgo http://www.ruisoft.com > > "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > I 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 request > > > > > > Hmm, 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? > > > ... > > > ... > > > > > > > > echo $xmldatavar; > > > ?> > > > ... > > > ... > > > ... > > > > > > Regards, > > > Johan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: how can I get the post content in php
I think I saw on this list that there's a $HTTP_RAW_POST_DATA (or similar) varibale. Sorry the net is slow like hell at work, I can't search for more info. But I think if you search for "raw" on the general mailing list's archive you will find it. Arpi > XML 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:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ > ID:yorgo http://www.ruisoft.com > "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > I 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 request > > > > Hmm, 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? > > ... > > ... > > > > > echo $xmldatavar; > > ?> > > ... > > ... > > ... > > > > Regards, > > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
XML 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:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I 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 request > > Hmm, 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? > > ... > ... > > echo $xmldatavar; > ?> > ... > ... > ... > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
> I 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 request Hmm, 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? ... ... ... ... ... Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
I 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 request -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >the program just can let me get the post string like my example > > I want post the xml file content to a php file, then I want get the post > > string that it's xml content. > > > > hehe, thanks for your help > > Did you solve your problem? > I dont think i understand you, but i tries to give a little summary what I > think you mean. > > 1. A page make a post request with XML data to a PHP file. > 2. The PHP file get the post request, and get the XML data. > 3. An then what? > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
>the program just can let me get the post string like my example > I want post the xml file content to a php file, then I want get the post > string that it's xml content. > > hehe, thanks for your help Did you solve your problem? I dont think i understand you, but i tries to give a little summary what I think you mean. 1. A page make a post request with XML data to a PHP file. 2. The PHP file get the post request, and get the XML data. 3. An then what? Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
Hello Johan the program just can let me get the post string like my example I want post the xml file content to a php file, then I want get the post string that it's xml content. hehe, thanks for your help -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > $HTTP_SERVER_VARS['QUERY_STRING'] --> it just can read the content by GET > > method. > > > > I want POST content > > Ah okay. Try this: > > $post_query = ""; > $keys_arr = array_keys($HTTP_POST_VARS); > $keys_size = sizeof($key_arr); > for($i=0; $i<$keys_size; $i++) { > if($i == 0) { > $post_query .= $keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; > } > else { > $post_query .= "&".$keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; > } > } > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
> $HTTP_SERVER_VARS['QUERY_STRING'] --> it just can read the content by GET > method. > > I want POST content Ah okay. Try this: $post_query = ""; $keys_arr = array_keys($HTTP_POST_VARS); $keys_size = sizeof($key_arr); for($i=0; $i<$keys_size; $i++) { if($i == 0) { $post_query .= $keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; } else { $post_query .= "&".$keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; } } Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
$HTTP_SERVER_VARS['QUERY_STRING'] --> it just can read the content by GET method. I want POST content thanx -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I mean post content string not a lot of variables > > > > etc: > > > > aaa.html post a=1&b=2 to bbb.php > > > > I want use php to read the string a=1&b=2 not $a and $b > > I not sure I understand you, but are you looking for > $HTTP_SERVER_VARS['QUERY_STRING'] ?? > > Regards, > > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
> I mean post content string not a lot of variables > > etc: > > aaa.html post a=1&b=2 to bbb.php > > I want use php to read the string a=1&b=2 not $a and $b I not sure I understand you, but are you looking for $HTTP_SERVER_VARS['QUERY_STRING'] ?? Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]