Page 1 of 1

how is server receive request

Posted: Mon Oct 19, 2009 4:11 am
by hero132
Hello all,
I writing a website, it has a function that it will receive request from a application program. When the program sent request to
it, it will receive request and parser request content then sent again response to the program. But I don't know website will listen request and receive request. Can you help me?
I trying to use $_POST in website to listen and receive request from the program but no success.
My code:
foreach ($_POST as $key => $value)
{
echo "$_POST";
}
Thanks,

Re: how is server receive request

Posted: Mon Oct 19, 2009 4:22 am
by el_gato
hero132 wrote:Hello all,
I writing a website, it has a function that it will receive request from a application program. When the program sent request to
it, it will receive request and parser request content then sent again response to the program. But I don't know website will listen request and receive request. Can you help me?
I trying to use $_POST in website to listen and receive request from the program but no success.
My code:
foreach ($_POST as $key => $value)
{
echo "$_POST";
}
Thanks,
echo $_POST will result an array, not the parameters and values sent by your application program. From your code above, the value is $value and the parameter is $key. if $_POST was empty, try to use $_GET.

Kind Regards
- Lorensius W. L. T
- http://www.londatiga.net-

Re: how is server receive request

Posted: Mon Oct 19, 2009 1:57 pm
by califdon
hero132 wrote:Hello all,
I writing a website, it has a function that it will receive request from a application program. When the program sent request to
it, it will receive request and parser request content then sent again response to the program. But I don't know website will listen request and receive request. Can you help me?
I trying to use $_POST in website to listen and receive request from the program but no success.
My code:
foreach ($_POST as $key => $value)
{
echo "$_POST";
}
Thanks,
It sounds like you are describing an Ajax transaction. If your application is not sending an entire web page ("<html> ..."), but only sending data, then the page that requests the data must include a call to the XMLHttpRequest object, including a function to receive the data when the ReadyState indicates that new data has been received. Read http://www.w3schools.com/Ajax/ajax_httprequest.asp.

Re: how is server receive request

Posted: Mon Oct 19, 2009 8:49 pm
by hero132
Thanks everybody
I sent data from application program that i write by actionscript, it will sent request which is a text file to my webserver,
Code of it is :
var request:URLRequest = new URLRequest( "http://wcc.dyndns.org/ppListen/pp-lis.php" );

// Create some variables to send
var user:String = "admin";
var pass:String = "123456";
var variables:URLVariables = new URLVariables();
variables.someText = "user_active:" + user + ", pass_active:" + pass;
request.data = variables;
sendToURL(request);
request.method = URLRequestMethod.POST;

After I want my webserver will receive text file and parser it to response to application software. Above, I only echo "$_POST" to test webserver received request content, but it show nothing
I can't how i should process it to receive the request.

Re: how is server receive request

Posted: Mon Oct 19, 2009 11:37 pm
by el_gato
try using var_dump($_REQUEST), see the results..

Re: how is server receive request

Posted: Tue Oct 20, 2009 3:44 am
by hero132
I used your way but not success, I still can't get content of request from application software

Re: how is server receive request

Posted: Tue Oct 20, 2009 3:58 am
by Mark Baker
Do the web server logs show that it has received the request?

Re: how is server receive request

Posted: Tue Oct 20, 2009 9:42 am
by el_gato
hero132 wrote:I used your way but not success, I still can't get content of request from application software
Check your web server access log..

Kind Regards
-Lorensius W. L. T-
-http://www.londatiga.net-

Re: how is server receive request

Posted: Tue Oct 20, 2009 10:49 pm
by hero132
Thank you so much
I received content of request. Do you help me, how can i sent response to application software?
You guide me about sent response to application software.

Re: how is server receive request

Posted: Wed Oct 21, 2009 10:01 am
by el_gato
To send response back to your application just print any string that what your application need.
Ex,

if ($_POST['test']) {
...
..
..
die('OK');
}

Kind Regards
- Lorensius W. L. T -
- http://www.londatiga.net -

Re: how is server receive request

Posted: Wed Oct 21, 2009 10:52 pm
by hero132
I done
Thank you so much