Relaying information from PHP Script/MySQL
Don't know what this forums like, hoping it's as friendly as some of the forums i've come across, but hey i'm Kyle :)
Right, I'm going to explain into as much detail as possible what I want to achieve here...
I Have VB6.0 Pro Edition, I Have multiple sites, one of which is what I'm needing help with.
I run an internet radio station (http://www.kt-radio.co.cc/). I Have a specific server for each of
a) Front end website (Public)
b) DJ Panel, which is where the staff login and fetch notices, requests, messages, pm's etc.
I basically want to relay different parts of the website (all written in php with a MySQL Database) into a VB executable so DJ's can download it and use the DJ Panel without a browser as it can get frustrating.
Different features I want to include are;
- Login (Using the existing login's)
- Message Box
- Set DJ Message
- SHOUTcast Server Status
- Staff Chat (Basically a shoutbox)
- Notifications (Haven't got this feature)
All of the above, Barr the notifications already exist on a website.
I Can Message you with any ftp login or URLS you might need.
I Have a limited knowledge with stuff like this, i can build simple VB apps, and write simple PHP, but bringing them both together :shoot:.
PM Me if you'd rather help through E-Mail or BlackBerry Messenger.
Thankyou!
Kyle:)
Re: Relaying information from PHP Script/MySQL
P.S: I'm hopeless with chaging messing with MySQL. Installed it with a base script and built ontop of it (Bit of a Cheat ;))
Re: Relaying information from PHP Script/MySQL
Anything posted here will be picked up by bots by Monday, so I'd remove it NOW, and hope they haven't picked up on it. We can PM you, only with a current USER ID!
Re: Relaying information from PHP Script/MySQL
ahh sorry about that, I'm on it.:blush:
Re: Relaying information from PHP Script/MySQL
Don't suppose you'd be able to help out on this dglienna...?
Re: Relaying information from PHP Script/MySQL
Not really. I'd suggest starting with VB.Net or VS2010 and C#. While VB6 might be able to cobble together various band-aids and scripts, I'd scrap the idea of using VB6.
Re: Relaying information from PHP Script/MySQL
Ah right, downloaded vb2010 last night, havent had chance to play around with it yet though... bit scared of eveni installing C# never even thought about learning it.
Thanks
Re: Relaying information from PHP Script/MySQL
Might be easier if you are GOOD at VB6, as it's a bit different. If not, then VB.Net is the way to learn...
Re: Relaying information from PHP Script/MySQL
Wouldn't say I'm "Good" as such.. But I have 'above limited knowledge' . And I have a bit of an expansion to what I was asking that might make it easier to interpret..
Quote:
<?php
$ip = "IP ADDRESS HERE";
$port = "PORT";
$fp = @fsockopen($ip,$port,$errno,$errstr,1);
if (!$fp) {
$title = "Connection timed out or the server is offline ";
} else {
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp)) {
$info = fgets($fp);
}
$info = str_replace('</body></html>', "", $info);
$split = explode(',', $info);
if (empty($split[6])) {
$title = "No song is currently playing ";
} else {
$count = count($split);
$i = "6";
while($i<=$count) {
if ($i > 6) {
$title .= ", " . $split[$i];
} else {
$title .= $split[$i];
}
$i++;
}
}
}
$title = substr($title, 0, -2);
print $title;
?>
Thats what I wasnt to relay to the VB project, with alot of other code of a similar format. I just don't know what to view it with.
EDIT: I know I need a reader of sorts, but I have never had to deal with a MySQL query with vb before, Only time I edit MySQL querys is when I am writing it in notepad for php. The output of this query, in PHP will display in text, is their a way I can feed that text through to a label of sorts? Need it as a variable really but I don't have a clue :-#
Re: Relaying information from PHP Script/MySQL
Still I don't quite understand what you want to achieve.
Do you want to rewrite the above code to VB6?
Or do you want a variable in VB which holds the above program code? Or the output of it?
Re: Relaying information from PHP Script/MySQL
Quote:
Originally Posted by
WoF
Still I don't quite understand what you want to achieve.
Do you want to rewrite the above code to VB6?
Or do you want a variable in VB which holds the above program code? Or the output of it?
I'll try have another shot at it lol.
'SHOUTcast DNAS Stats' are hosted on a seperate webserver (Not owned by me).
I Have the PHP code for these stats, which relay the stats to my DJ Panel.
I Want the stats from shoutcast dnas, to relay into the VB app (Somehow...)
I can't upload anything as the file limit is quiet small. So I can't upload a screenshot of the stats.
The code i posted in the previous post is the the "Song now Playing" stat.
If someone could tell me how to use this PHP code in VB I would greatly appreciate it!
And thankyou for getting back to me mate:):wave:
EDIT:
Quote:
Do you want to rewrite the above code to VB6?
I think this could be what I want to achieve yes, but what component would I use?
Thanks
Re: Relaying information from PHP Script/MySQL
Depends on the browser, and/or the language you use...
Re: Relaying information from PHP Script/MySQL
Quote:
Originally Posted by
dglienna
Depends on the browser, and/or the language you use...
My project supports FireFox and Internet Explorer. 2 different forms for each, when you load the project, it asks you which one you want to use, and their the most popular for people tuning in
Thanks
EDIT: I want to try and stay away from the internet tools though, I have so many problems with them both:/
Re: Relaying information from PHP Script/MySQL
Many things you do in this PHP script are to be done more complicated in VB6, but I think all in all everything could be converted to pure VB6 code.
As I understood you want a stand-alone application which is NOT a webbrowser.
Otherwise, VB6 has a WebBrowser control which might be capable to run PHP, although I have to admit my experience with this control is rather limited.
Re: Relaying information from PHP Script/MySQL
Quote:
Originally Posted by
WoF
Many things you do in this PHP script are to be done more complicated in VB6, but I think all in all everything could be converted to pure VB6 code.
As I understood you want a stand-alone application which is NOT a webbrowser.
Otherwise, VB6 has a WebBrowser control which might be capable to run PHP, although I have to admit my experience with this control is rather limited.
Yeah It would be alot better to do it in code than using the WebBrowser control as, In my oppinion, it is crap.
If you could point me in the right direction on how to convert it to vb6 code, or how to convert it into Visual studio 2010 code,I would be much greatful.
I sat up for hours last night trying to work it out, but had no luck.
Cheers
Re: Relaying information from PHP Script/MySQL
As I understand yout PHP, you use an ftp connection to download a specific html document and split it up to read certain content.
First to establish an ftp connection you'd possibly use the INET control (I'm only talking VB6 here), which is read into a variable named info. You'd have to look up on details of how to do this.
VB6 nows a Replace command similar to your PHP str_replace.
To substitute the explode function you'd use Split() in VB6.
Let's assume we have the loaded page in a var named Info, which is declared and filled elsewhere
I'd make an attempt to show you a translation of your PHP to VB6
Code:
'we have to declare variales in VB
Dim SplitRes() as string 'the result array of the explode
Dim title$, i%, count%
'$info = str_replace('</body></html>', "", $info);
Info = Replace(Info,"</body></html>", "")
'$split = explode(',', $info);
SplitRes = Split(Info, ",")
'if (empty($split[6])) {
If SplitRes(6) = "" Then
'$title = "No song is currently playing ";
title = "No song..."
'} else {
Else
'$count = count($split);
count = UBound(SplitRes)
'$i = "6";
i = 6
'while($i<=$count) {
While i < count
'if ($i > 6) {
If i > 6 Then
' $title .= ", " . $split[$i];
' } else {
' $title .= $split[$i];
' }
End If
'$i++;
i = i+1
'}
Wend
'}
End If
'$title = substr($title, 0, -2);
'???
' print $title;
There are some gaps there, because I'm not sure of PHP
a) how the .= operater works, so what is the result of $title .= "," . $split[$i]
b) how the substr function works and what its parameters are.
Also the above is simply a free-hand-attempt.
We could rewrite the loop to working VB6 code, if you could post the contents of such an Info string and explain the above mentioned functions.
Re: Relaying information from PHP Script/MySQL
Quote:
Originally Posted by
WoF
As I understand yout PHP, you use an ftp connection to download a specific html document and split it up to read certain content.
First to establish an ftp connection you'd possibly use the INET control (I'm only talking VB6 here), which is read into a variable named info. You'd have to look up on details of how to do this.
VB6 nows a Replace command similar to your PHP str_replace.
To substitute the explode function you'd use Split() in VB6.
Let's assume we have the loaded page in a var named Info, which is declared and filled elsewhere
I'd make an attempt to show you a translation of your PHP to VB6
Code:
'we have to declare variales in VB
Dim SplitRes() as string 'the result array of the explode
Dim title$, i%, count%
'$info = str_replace('</body></html>', "", $info);
Info = Replace(Info,"</body></html>", "")
'$split = explode(',', $info);
SplitRes = Split(Info, ",")
'if (empty($split[6])) {
If SplitRes(6) = "" Then
'$title = "No song is currently playing ";
title = "No song..."
'} else {
Else
'$count = count($split);
count = UBound(SplitRes)
'$i = "6";
i = 6
'while($i<=$count) {
While i < count
'if ($i > 6) {
If i > 6 Then
' $title .= ", " . $split[$i];
' } else {
' $title .= $split[$i];
' }
End If
'$i++;
i = i+1
'}
Wend
'}
End If
'$title = substr($title, 0, -2);
'???
' print $title;
There are some gaps there, because I'm not sure of PHP
a) how the .= operater works, so what is the result of $title .= "," . $split[$i]
b) how the substr function works and what its parameters are.
Also the above is simply a free-hand-attempt.
We could rewrite the loop to working VB6 code, if you could post the contents of such an Info string and explain the above mentioned functions.
I'll PM you with everything I have to hand.
Thanks for taking the time to do that
1 Attachment(s)
Re: Relaying information from PHP Script/MySQL
For WoF - Can't attach in PM
Attachment 29566
Re: Relaying information from PHP Script/MySQL
Ok. I shall take a look to it later that evening, and try to point you in the right direction (as long as I grasp correctly what it is that you actually want. ;) )
Re: Relaying information from PHP Script/MySQL
Ok thanks mate:) greatly appreciated
Re: Relaying information from PHP Script/MySQL
Ok, there is a lot I'd have to say about your little framework of forms. If I was to start with the Sub Main then this:
Code:
Set fMainForm = New Form1
Load Form1
Form1.Show
is already useless in 2 ways. if you create a new form in fMainForm you shoud use it, but you aren't. Instead you show the original Form1. Also you do not need to explicitly load it, although your codes seems to work as expected.
Code:
Form1.Show 'is already sufficient. Or if you like you use instead:
Set fMainForm = New Form1
fMainForm.Show 'or otherwise the created form is never used.
There are a couple of more issues of greater importance.
First, you do not need 2 separate forms for the two supported browsers. You'd only have to store the required browser's path in a variable and use this variable in the button's code.
Also all button's code did fail on my computer, because I have a german XP, where the name of the program folder is different. So you have to use an Environment variable to get the name of the program folder, or it will invariably fail on all non-english systems.
Also I'd advice to use the sstab control instead of tabstrip, because it might be easier to use for a beginner.
If you like, and if the issue is not very pressing, I can find some time to walk through it and make a few necessary adaptionsd and corrections to set you up on the right way.