|
-
April 20th, 2012, 10:49 AM
#16
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.
-
April 20th, 2012, 03:10 PM
#17
Re: Relaying information from PHP Script/MySQL
 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
-
April 20th, 2012, 03:57 PM
#18
Re: Relaying information from PHP Script/MySQL
For WoF - Can't attach in PM
KT-Radio DP.zip
-
April 22nd, 2012, 01:05 PM
#19
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. )
-
April 22nd, 2012, 03:37 PM
#20
Re: Relaying information from PHP Script/MySQL
Ok thanks mate greatly appreciated
-
April 23rd, 2012, 06:04 AM
#21
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|