FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour How to test a POST from cmd
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to test a POST from cmd
Posted: Tue Jan 04, 2022 01:02 PM

echo "hello world" | ./modharbour test.prg

whatever is written there ("hello world") becomes the AP_Body() from modharbour

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to test a POST from cmd
Posted: Tue Jan 04, 2022 03:15 PM
Testing it using C language:

test.c
Code (fw): Select all Collapse
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to test a POST from cmd
Posted: Tue Jan 04, 2022 08:29 PM
Simplest echo.prg

echo prg
Code (fw): Select all Collapse
function Main()

   ? FReadStr( hb_GetStdIn(), 256 )

return nil


echo "Hello world" | echo.exe
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion