| View previous topic :: View next topic |
| Author |
Message |
EvilHottness Advanced Cheater
Reputation: 0
Joined: 29 Apr 2008 Posts: 64 Location: Co
|
Posted: Sun Sep 21, 2008 7:39 pm Post subject: Visual Basic/PHP question? |
|
|
Alright so i've made a vb based server works great runs what i want on it, but how would i implement PHP into my VB6 web server? you know how when you install php with apache , copies files and picks it up basically is it possible to do it the same way or should i try installing php and configuring it to my vb webserver is this possible?
_________________
|
|
| Back to top |
|
 |
Polynomial Grandmaster Cheater
Reputation: 5
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
|
Posted: Tue Sep 23, 2008 7:22 pm Post subject: |
|
|
I'm actually surprised at myself for not realising this is possible before.
PHP works in Apache using a module. The module causes the HTTP request to be sent through the PHP executable and the results of the PHP executable are sent to the client.
You can do this in VB by installing PHP somewhere and making your application run the following command line:
php C:\path\to\documents\requested_file.php
Then read the results from the standard output (stdout) with an API or if you're using .NET you can read from the StandardOutput member of the Process class.
I'm off to test this out on my simple web server in VB.NET.
|
|
| Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
Posted: Tue Sep 23, 2008 11:16 pm Post subject: |
|
|
heres a implemention of PHP in VB6 got this from a AshleysWebBrowser
| Code: |
ElseIf Right(path, 4) = ".php" Then
'PHP SUPPORT!
'I have never programed in php in my life, and I've glimpsed php code only once
'hence why it lacks some of the features (Like what? I just added cookies!) of perl.
'be polite to other requests.
While executingcgi
DoEvents
Wend
executingcgi = True
stats.List(Index) = "Exec PHP:" & cmd
'go to the directory with the php script in it. (tell windows where '.' is)
ChDir Left(path, InStrRev(path, "\"))
'Dim parsed As Dictionary
Dim parsed As Dictionary
Set parsed = tophpvariables(CStr(data), CStr(postdata), CStr(headers("cookie")))
fn = path & "temp.php" 'create temporary php script
tempkill = fn
tmp = "<?php" & vbNewLine & "echo ""Content-Type: text/html\n\n"";" & vbNewLine
For q = LBound(parsed.Keys) To UBound(parsed.Keys)
k = parsed.Keys(q)
v = parsed(k)
tmp = tmp & "$" & k & " = """ & v & """;" & vbNewLine
Next q
tmp = tmp & "include(""" & path & """);" & vbNewLine & "?>"
Open fn For Output As #5
Print #5, tmp
Close #5
On Error Resume Next
If fso.FileExists("C:\temp.txt") Then Kill "C:\temp.txt"
On Error GoTo 0
'run the perl script (PHP MUST BE IN YOUR AUTOEXEC PATH VARIABLE)
Shell "command.com /c php-cli.exe " & fn & " >""C:\temp.txt""", vbHide
|
What it does is ..
runs command.com /c php-cli.exe website path(FN) > C:\temp.txt
"> C:\temp.txt" is where the outputted php file goes.. so it then loads up the temp.txt file and sends it off.. its a pretty slow setup.. but what can u do about it.
_________________
|
|
| Back to top |
|
 |
|