is it possible to change a text on a hosted website using visual basic

is it possible to change aspecific content or text on hosted website, which is created in php,using vb. take an example of google, in which i would like to change a text under the textfield. is it possible
raj_msAsked:
Who is Participating?
 
Erick37Connect With a Mentor Commented:
Here is a simple example of how th use the inet control to download, modify, and upload your files...

Internet Transfer Control reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/inet98/html/vbobjInternetControl.asp

The code:

Option Explicit

'Add the "Microsoft Internet Transfer Control" to your form (Project->Components)
'Add 1 TextBox and 2 Command Buttons
'This example uses FTP to download a file from a server,
'Display its contents in a textbox, and then upload the modified text.
'Set Text1.MultiLine = True
'Set Text1.ScrollBars = Both

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim sFileText As String
Dim sURL As String
Dim sPass As String
Dim sUser As String
Dim sRemoteFile As String
Dim sLocalFile As String

Private Sub Form_Load()
    Command1.Caption = "Download"
    Command2.Caption = "Upload"
    'For our test set the server values here
    sURL = "ftp://ftp.yourserver.com"
    sRemoteFile = "/test.php"
    sLocalFile = "c:\test.php"
    sUser = "yourusername"
    sPass = "yourpassword"
End Sub

Private Sub Command1_Click()
'
'File Download
'
    On Error GoTo FTPGETERROR
    Dim ff As Long
    Dim sTmp As String
    Dim lLen As Long
    'prevent reentrance
    Command1.Enabled = False
    'download our file
    With Inet1
    .Protocol = icFTP
    .RequestTimeout = 60
    .RemotePort = 21
    .AccessType = icDirect
    .URL = sURL
    .UserName = sUser
    .Password = sPass
    End With
   
    'retrieve the file from the server
    Inet1.Execute , "GET " & sRemoteFile & " " & sLocalFile
    Wait
    'now load the file into the textbox
    ff = FreeFile
    Text1.Locked = True 'Prevent user input
    Text1.Text = "" ' Clear out the old text
   
    'Read the file into the textbox
    Open sLocalFile For Input As #ff
    lLen = LOF(ff)        'LOF function returns length of file
    Text1.Text = Input$(lLen, ff)
    Close #ff   ' Close file.
   
    Text1.Locked = False 'Reenable it
    Command1.Enabled = True
    Exit Sub
FTPGETERROR:
    MsgBox "Error: " & Err.Number & " " & Err.Description, vbCritical, Err.Source
    Command1.Enabled = True
    Text1.Locked = False
End Sub

Private Sub Command2_Click()
'
'File Upload
'
    On Error GoTo FTPPUTERROR
    Dim ff As Long
    'prevent reentrance
    Command2.Enabled = False
    'upload our file
    With Inet1
    .Protocol = icFTP
    .RequestTimeout = 60
    .RemotePort = 21
    .AccessType = icDirect
    .URL = sURL
    .UserName = sUser
    .Password = sPass
    End With

    Text1.Locked = True 'Prevent user input
    'Write the text to our local file
    ff = FreeFile
    Open sLocalFile For Output As #ff
    Print #ff, Text1.Text
    Close #ff   ' Close file.
    Text1.Locked = False 'Reenable it
    'Put the file to the server
    Inet1.Execute , "PUT " & sLocalFile & " " & sRemoteFile
    Wait
    Command2.Enabled = True
    Exit Sub

FTPPUTERROR:
    MsgBox "Error: " & Err.Number & " " & Err.Description, vbCritical, Err.Source
    Command2.Enabled = True
    Text1.Locked = False
End Sub

Private Sub Wait()
    Do While (Inet1.StillExecuting = True)
        DoEvents
        Sleep 50
    Loop
End Sub
0
 
unknown_routineCommented:


Hi,

Changing the way text shows in your browser is possilbe.
But note that you can not change the the text which is actually in the website server.(can not be changed without hacking and I'm sure you are not into that)

Changing the way text shows in your browser can be done this way:

Step1: you show the webpage in a webbroswer component which is put on your form.

Step2: you read the HTML of the page.

dim s as string

s=Webbrowser.document.innerhtml

Now s contains HTML (PHD) text. you can find the text and edit it.

then

Webbrowser.document.innerhtml =s




0
 
unknown_routineCommented:
any questions : please mention.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
raj_msAuthor Commented:
i am creating a webeditor for my website, instead of changing all the web page, i have planned to edit only some text using vb.
0
 
unknown_routineCommented:
I see,

Since you own that website, so you should be able to go through the steps in my previous comment and

then publish it back to the website.

0
 
Erick37Commented:
I think you want to edit the PHP file?

If this is correct, then the Internet Transfer Control (which comes with VB) can be used to FTP the file(s) to and from your server.
You can edit the source text using a standard TextBox or via code in VB.

If you need more info or some examples of using the Inet Control, just ask.
0
 
raj_msAuthor Commented:
i want to about ITC of vb
0
 
RanjeetRainCommented:
See this page. Very good code - http://www.thescarms.com/vbasic/inetftp.asp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.