echo "hello world" | ./modharbour test.prg
whatever is written there ("hello world") becomes the AP_Body() from modharbour
How to test a POST from cmd
- Antonio Linares
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: How to test a POST from cmd
Testing it using C language:
test.c
gcc test.c -otest
finally to test it:
echo "Hello world" | ./test
test.c
Code: Select all | Expand
#include <stdio.h>
#include <string.h>
int main( int args, char * argv[] )
{
char buffer[ 250 ];
memset( buffer, 0, sizeof( buffer ) );
read( fileno( stdin ), buffer, sizeof( buffer ) - 1 );
printf( "%s\n\n", "Content-Type: text/html;" );
printf( "%s", buffer );
return 0;
}
gcc test.c -otest
finally to test it:
echo "Hello world" | ./test
- Antonio Linares
- Site Admin
- Posts: 42511
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: How to test a POST from cmd
Simplest echo.prg
echo prg
echo "Hello world" | echo.exe
echo prg
Code: Select all | Expand
function Main()
? FReadStr( hb_GetStdIn(), 256 )
return nil
echo "Hello world" | echo.exe