Results 1 to 4 of 4

Thread: Getting information via Inet

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Getting information via Inet

    I've got this code to send information via Inet.

    VB Code:
    1. strMsg = Replace(Text2.Text, vbCrLf & vbCrLf & vbCrLf, "</p><br /><p>")
    2. strMsg = Replace(strMsg, vbCrLf & vbCrLf, "</p><p>")
    3. strMsg = "<p>" & Replace(strMsg, vbCrLf, "<br />") & "</p>"
    4.  
    5. 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:
    1. 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??

  2. #2
    Junior Member
    Join Date
    Jul 2006
    Posts
    22

    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:
    1. 'Initialize variables.
    2.   lStart = 1
    3.   lEnd = 1
    4.   sFindStart = "<p>" 'Enter the text preceding the information you want here
    5.   sFindEnd = "</p>" 'Enter the text Following the information you want here
    6.   ssource = Inet1.OpenURL ("http://www.yoursite.com") 'obviously your site info goes here.
    7.     'Get the document text.
    8.  
    9.    
    10.     'Find the start position.
    11.   lStart = InStr(lStart, sSource, sFindStart, vbTextCompare)
    12.  
    13.   'Find the end postion only if the start text is found.
    14.       If lStart Then
    15.      
    16.           'Add the length of the search text.
    17.               lStart = lStart + Len(sFindStart)
    18.          
    19.           lEnd = InStr(lStart, sSource, sFindEnd, vbTextCompare)
    20.          
    21.           If lEnd > lStart Then
    22.               Text1.Text = Mid$(sSource, lStart, lEnd - lStart)
    23.            
    24.           Else
    25.               Debug.Print "End text not found."
    26.           End If
    27.          
    28.       Else
    29.      
    30.           Debug.Print "Text not found."
    31.          
    32.       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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    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

  4. #4
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width