Page 1 of 1
How to test a POST from cmd
Posted: Tue Jan 04, 2022 1:02 pm
by Antonio Linares
echo "hello world" | ./modharbour test.prg
whatever is written there ("hello world") becomes the AP_Body() from modharbour
Re: How to test a POST from cmd
Posted: Tue Jan 04, 2022 3:15 pm
by Antonio Linares
Testing it using C language:
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
Re: How to test a POST from cmd
Posted: Tue Jan 04, 2022 8:29 pm
by Antonio Linares
Simplest echo.prg
echo prg
Code: Select all | Expand
function Main()
? FReadStr( hb_GetStdIn(), 256 )
return nil
echo "Hello world" | echo.exe