Created
February 6, 2018 02:54
-
-
Save shindakun/bd6a9a6142529e76704250ffc414fd3b 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
// Without the protocol it will throw the following: | |
// $ go run main.go | |
// Get podcasts.files.bbci.co.uk/b006qtl3.rss: unsupported protocol scheme "" | |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
) | |
func main() { | |
resp, err := http.Get("http://podcasts.files.bbci.co.uk/b006qtl3.rss") | |
if err != nil { | |
fmt.Println(err) | |
} | |
body, err := ioutil.ReadAll(resp.Body) | |
defer resp.Body.Close() | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println(string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment