PB Interpreter » Use PB instead of PHP or Perl for websites!

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by Kwai chang caine »

In fact, it's for my job an internal site, in private network :D

It's the first time i use CGI script, and i'm interesting to run program by network

There are a long time, i have thinking to create a PB script langage, with the lib network
Create PB server with all the PB function inside, and try to sending script for execute the *.pb by network :D
But i never had the time, and surely also the knowledge :oops:

So when i have see your code, a little bit like that, except you create the EXE "in live", i want to try it immediately 8)

Thanks again for your job
ImageThe happiness is a road...
Not a destination
User avatar
freepurebasic
Enthusiast
Enthusiast
Posts: 123
Joined: Fri Sep 24, 2010 12:02 pm
Location: world wide web

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by freepurebasic »

hi again Chane!

well how is doing the network's building ? are you destroyed yet?

well,if not try this without "bang-bang"...
ready cowboy?


http://www.apachefriends.org/en/xampp-windows.html
from here get xampp(apache server +php+mysql for windows)


http://freebasic.net/index.php/download
from here get freebasic (is like quick basic style plus some z80 basic commands)
(Windows 0.21.1 Installer Compiler for Windows, including libraries, headers {...} )

and the ide editor
FbEdit Windows A full-featured IDE written in FreeBASIC using {...}


after you installed freebasic in c:\freebasic
and the editor in c:\freebasic\ide
(read the instruction there) you will able to compile an little exe like purebasic style...

Code: Select all

Print "Content-Type: text/html"; Chr(10)
Print "Fancullo Italia"; 
after this ... you will get let say "d1.exe"

create in c:\ the new folder "int" and paste "d1.exe"

now after you start your server apache(from xampp panel) you will have "http://localhost/" working

now go in "c:\xampp\htdocs\" and create a new folder named "chane"

so now you have "c:\xampp\htdocs\chane\" and offcource "http://localhost/chane/"

now copy paste this file:
index.cgi

Code: Select all

#!"c:\int\d1.exe"


yes is there only one line code!!!


open opera,ie,firefox, i don't know ...chrome a browser you have... http://localhost/chane/

now you understand how is working the guy's "interpreter"

if you don't like to prove all this just copy paste d1.exe in "c:\xampp\cgi-bin\"
and see it in browser like this :
http://localhost/cgi-bin/d1.exe




i used this example becouse i haven't licensed copy of purebasic, but if you are able to compile purebasic .exe file...
try the andy's interpreter to compile it like d1.exe (remember to place it in "c:\int\"), put it in place of my exe file,then instread my index.cgi file use this

Code: Select all

#!"c:\int\d1.exe"

OpenConsole()
PrintN("Content-Type: text/html")
PrintN("")
PrintN("Hello from Purebasic 4.30 on your HTTP WebServer!")


let me know if the guy's interpreter works!

see'ya , happy self auto-destruction, have fun !
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by Kwai chang caine »

Thanks a lot FREEPUREBASIC for your long explanation 8)
That's works, that's works :D

The question i ask to me now, is it possible to send parameter directly with IE at Interpreter.exe ????
ImageThe happiness is a road...
Not a destination
User avatar
freepurebasic
Enthusiast
Enthusiast
Posts: 123
Joined: Fri Sep 24, 2010 12:02 pm
Location: world wide web

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by freepurebasic »

depends what's meaning directly(not sure this you want).

1.via cmd.exe:
interpreter.exe script.pb

not sure you must chech the script

OR
2.via browser http://localhost/0/?q12345

this is the code i sent you in freebasic not purebasic!

Code: Select all

Print "Content-Type: text/html"; Chr(10)
Print "Ciao Chane! here are your QUERY_STRING:"+Environ("QUERY_STRING");
compile it like d1.exe and copy paste on c:\int

i put here the example + exe
http://www.zshare.net/download/87686636d5b70b83/




there is still another case
3. is via your executable that is in the same time an http server and client(browser+server+parser)
in this case you must write a minimal http server and to include a parser






-----------------------------------------
and if you are CRAZY more than me you can download fasm
and try to compile this

Code: Select all

format pe console
include 'win32ax.inc'

.data

_message        db 'Content-Type: text/html',10,'Ciao Chane!',13,10
_message.len    = $ - _message

.code

begin:
        push    eax
        invoke  GetStdHandle,STD_OUTPUT_HANDLE
        mov     ecx,esp
        invoke  WriteFile,eax,_message,_message.len,ecx,0
        pop     eax
        invoke  ExitProcess,0

.end begin
compile it like d1.exe and how you know copy/paste to c:\int

download the script + exe here
http://www.zshare.net/download/87687645fb808276/
here is working
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by Kwai chang caine »

Thanks a lot FREEPUREBASIC, i take a look to your example and give to you news
Again thanks 8)
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by Kwai chang caine »

Waoooouuuuuhh !!!!!

I have tried your splendid little program (The second way)

And i have see the nice sentence :
Ciao Chane! here are your QUERY_STRING:q12345

It's cool, thanks to you, i have see it's possible to send parameter

I have not again try ASM way, i have again never use ASM.
But it's interesting i'm sure, if i can i try it :wink:

Thanks a lot for your long and precious explanation 8)
ImageThe happiness is a road...
Not a destination
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by Primoz128 »

Im getting Object not found! + Error 404 from the link...
I wana try this.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Re: PB Interpreter » Use PB instead of PHP or Perl for websi

Post by AND51 »

@ everybody


Hello,

A lot of people are interested in my "PB Interpreter". Also, a lot of time has passed since I wrote the PB Interpreter in 2009.
Let me say that I've changed my personal Computer and my server a lot of times, so that the source code of this project now resides somwhere in a moldy backup. However, the most recent source code is exactly that one from page 1 of this thread! Nothing else was provided by the URL from page 1.

The link on page 1 pointing to a zip-file on my server is not valid any more. You will only say hello to my Apache.


Sorry, that I could not provide better news. My last PB version was 4.51 or something like that... But - since 2009 I've gained a lot of experience concerning Linux, servers and such! Now I fully understand file ownerships, how Apache works, and so on. If PureBasic gets back my attention some day, I will be able to greatyl improve this project! Until then, I continue to keep an eye on PureBasic, this thread and your mails! Thank you so much for your interest! :)
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Post Reply