Solved

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

Posted on 2004-09-16
8
187 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:raj_ms
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12075793


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
 
LVL 15

Expert Comment

by:unknown_routine
ID: 12075803
any questions : please mention.
0
 

Author Comment

by:raj_ms
ID: 12075853
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 15

Expert Comment

by:unknown_routine
ID: 12076105
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
 
LVL 32

Expert Comment

by:Erick37
ID: 12076400
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
 

Author Comment

by:raj_ms
ID: 12076697
i want to about ITC of vb
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 12077685
See this page. Very good code - http://www.thescarms.com/vbasic/inetftp.asp
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 12077805
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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question