Skip to content
WJunction - Webmaster Forum

How to get pagesource of Google ?

Status
Not open for further replies.

CatchItBaby

Experienced Member
623
2008
20
Code:
Dim req As HttpWebRequest = Nothing
        Dim pagesource As StreamReader
        Dim response As HttpWebResponse

        
        req = WebRequest.Create("http://www.google.co.in")
        req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100625 Firefox/3.6.8"
        req.Timeout = 60000
        req.Method = "GET"
        'req.CookieContainer = cookies
        req.AllowAutoRedirect = False
        req.ContentType = "application/x-www-form-urlencoded"

        response = req.GetResponse()
        pagesource = New IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"))

        Dim str As String = pagesource.ReadToEnd
        
        Dim iofile2 As New StreamWriter("c:\post.txt", False, Encoding.Default)
        iofile2.Write(str)
        iofile2.Close()


But i m getting invalid characters like

0a64f2.jpg


How to get rid of selected words

Thanks
 
Last edited:

12 comments

EDIT : wait you want source code ?

lol , it's Google , not some noob site !

All source codes are encrypted .

PS: Use your brain !
 
Google.co.in is just a example

0a64f2.jpg


want to get rid of selected character in image ONLY NOTHING ELSE I WANT TO DO

ascii value of selected character is = 10

may be i m missing encoding or something else in above example
 
hmm maybe you should use UTF8Encoding .
If you are trying to create a bot or a leecher, there are other easy ways :)
 
but in above coding i did that ..

pagesource = New IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"))

Dunno why it gave wired character :(
 
Status
Not open for further replies.

About the author

C
Experienced Member · Joined
623
Messages
20
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom