EZWeb Server

Started by Jeffrey Ferreira, September 26, 2022, 12:23:17 PM

Previous topic - Next topic

Jeffrey Ferreira

Hello List,
I was able to get ezweb server running and rendering static html pages.
when i use print(%PRINT_FN) - it seems to return a file
i'm trying to create a dynamic html page on the fly

so if user goes to localhost:8080/part=A123

i want to return an html page but i want to modify some of the info...
does anyone know how i can do that....
thanks
jeff

Mike King

You likely just need to format your output as an HTML page.  By default the system will assume a content-type of text/html.

For example (Note to make sure this came thru I replaced less than and greater than with { and } respectively):

  PRINT (%PRINT_FN) "{!DOCTYPE html}"
  PRINT (%PRINT_FN) "{html}{body}"
  OPEN (1,IOL=*) "products"
  READ (1,key=PART$,ERR=BadPart) part$, desc$, price
  CLOSE (1)
!
  PRINT (%PRINT_FN) "{table}"
  PRINT (%PRINT_FN) "{tr}{th}Part{/th}{th}Description{/th}{th}Price{/th}{/tr}
  PRINT (%PRINT_FN) "{tr}{td}"+part$+"{/td}{td}"+desc$+"{/td}{td}"+str(Price)+"{/td}{/tr}"
  PRINT (%PRINT_FN) "{/table}"
  PRINT (%PRINT_FN) "{/body}{/html}"
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

Hi Mike when i do this it seems to go into the Downloads Folder and when i open it , it is my program but in an encrypted format [pvxprg]

Mike King

Jeff,

What is the name of your program and what is the exact URL you are using?

The program should have a .pxp or .pvp suffix on its file name. 

For example:

Assuming your URL is:     http://localhost:8080/program1.pxp?part=A123

Then your program should be in the file "program1.pxp" on the server.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

Hi Mike

the program name is parts.pxp
i'm using http://localhost:8080/parts.pxp
i'm not using a query string at this time
it is an older version of pxplus 10.2

here is my program parts.pxp

0010 print (%PRINT_FN)"<html>"
0020 print (%PRINT_FN)"<head>"
0030 print (%PRINT_FN)"</head>"
0040 print (%PRINT_FN)"<body>"
0041 print (%PRINT_FN)"<h1>Hello Jeff</h1>"
0042 print (%PRINT_FN)"</body>"
0043 print (%PRINT_FN)"</html>"
0050 end

i'm pretty sure it is finding my program because in firefox here is what it shows on screen

[Pvxprg]�Ù���Õ�½�cai         ����������������������������������������c1'þ���������������X9�������Ù���Õ���½�������Ù��������������������������������������������������������������������������������������������������������������������������������������������€�'�   text/htmlÿ��
Ç$€&�<html>ÿ��Ç$€&�<head>ÿ��Ç$€&�</head>ÿ��(Ç$€&�<body>ÿ��)Ç$€&�<h1>Hello Jeff</h1>ÿ��*Ç$€&�</body>ÿ��+Ç$€&�</html>ÿ��2¦ÿ�ýè¦ÿ
%CONTENT_TYPE   %PRINT_FN���

Mike King

Ah -- that explains it. EZWeb only supported iNomads up until v14. 

On v10.20 it was only provided as a solution to run iNomads applications.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com