Created
March 9, 2017 02:35
-
-
Save matipan/51409a212d66f72a50163bfe4f0adcfc to your computer and use it in GitHub Desktop.
This file contains 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 characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"log" | |
"net/http" | |
"net/url" | |
"os" | |
"strings" | |
) | |
func main() { | |
f, err := os.Open("mails-carpinteros") | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer f.Close() | |
reader := bufio.NewReader(f) | |
for { | |
s, err := reader.ReadString('\n') | |
if err != nil { | |
break | |
} | |
s = strings.Trim(s, "\n") | |
s = strings.TrimSpace(s) | |
resp, err := http.PostForm("https://antoniopan.herokuapp.com/category/email/new", url.Values{"category": {"carpinteros"}, "email": {s}}) | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Printf("posting email %v got %v\n", s, resp.StatusCode) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment