Revisions
-
mrtdeh revised this gist
Dec 23, 2017 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ http://website.com/upser_profile_page . 4) Now get html of this whole page and print it in log as a string . */ package main @@ -52,4 +52,3 @@ func main() { } log.Println(string(data)) // print whole html of user profile data } -
mrtdeh renamed this gist
Dec 23, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mrtdeh revised this gist
Dec 23, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ http://website.com/upser_profile_page . 4) Now get html of this whole page and print it in log as a string . */ ``` package main @@ -52,3 +52,4 @@ func main() { } log.Println(string(data)) // print whole html of user profile data } ``` -
varver created this gist
Aug 27, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ /* This code Do the following stuff : 1) login to a website called : website.com by submitting password and username on the page with url :- http://website.com/login 2) Now after login using the cookies stored by this webiste access user profile page 3) Now using same client which stored the required cookies make another post request to user profile page present at page :- http://website.com/upser_profile_page . 4) Now get html of this whole page and print it in log as a string . */ package main import ( "code.google.com/p/go.net/publicsuffix" "io/ioutil" "log" "net/http" "net/http/cookiejar" "net/url" ) func main() { options := cookiejar.Options{ PublicSuffixList: publicsuffix.List, } jar, err := cookiejar.New(&options) if err != nil { log.Fatal(err) } client := http.Client{Jar: jar} resp, err := client.PostForm("http://website.com/login", url.Values{ "password": {"loginpassword"}, "username" : {"testuser"}, }) if err != nil { log.Fatal(err) } resp, err = client.PostForm("http://website.com/upser_profile_page", url.Values{ "userid": {"2"}, }) if err != nil { log.Fatal(err) } data, err := ioutil.ReadAll(resp.Body) resp.Body.Close() if err != nil { log.Fatal(err) } log.Println(string(data)) // print whole html of user profile data }