|
-
Aug 3rd, 2006, 06:47 PM
#1
Thread Starter
Frenzied Member
Getting information via Inet
I've got this code to send information via Inet.
VB Code:
strMsg = Replace(Text2.Text, vbCrLf & vbCrLf & vbCrLf, "</p><br /><p>")
strMsg = Replace(strMsg, vbCrLf & vbCrLf, "</p><p>")
strMsg = "<p>" & Replace(strMsg, vbCrLf, "<br />") & "</p>"
Inet1.OpenURL ("http://www.mysite.com/admin/test.php?body=" & strMsg)
Can I do it the other way around now, say enter 3 to a txtbox then
VB Code:
Inet1.OpenURL ("http://www.mysite.com/admin/getinfo.php?id=" & tetxbox1.text)
and with this populate the rest of my boxes with it's info???
can this be done??
-
Aug 3rd, 2006, 11:05 PM
#2
Junior Member
Re: Getting information via Inet
Are you asking if you can login to a website and then populate textboxes via the inet control? If so then yes you can.
VB Code:
'Initialize variables.
lStart = 1
lEnd = 1
sFindStart = "<p>" 'Enter the text preceding the information you want here
sFindEnd = "</p>" 'Enter the text Following the information you want here
ssource = Inet1.OpenURL ("http://www.yoursite.com") 'obviously your site info goes here.
'Get the document text.
'Find the start position.
lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
'Find the end postion only if the start text is found.
If lStart Then
'Add the length of the search text.
lStart = lStart + Len(sFindStart)
lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
If lEnd > lStart Then
Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
Else
Debug.Print "End text not found."
End If
Else
Debug.Print "Text not found."
End If
This will find text between 2 html tags (or any other specific text in the source) and place it in Text1.Text. You have to make sure that the info in sFindStart and sFindEnd is unique, or it will just find the first instance it comes across.
You can do this for each variable you need.
Hope that is what you're after.
-
Aug 3rd, 2006, 11:41 PM
#3
Thread Starter
Frenzied Member
Re: Getting information via Inet
My website, getinfo.php connects to my MySQL DB. I want each feild from my DB to be in it's own text box on my VB program.
So how to i get the right information in the right place
-
Aug 4th, 2006, 12:11 AM
#4
Fanatic Member
Re: Getting information via Inet
You could make getinfo.php use echo() to print each of the fields from the DB, seperated by something (like ***).
You could then use Split() to seperate the fields in your program and put each one in a textbox array
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
|