Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
getting html source code from website
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aldis Andrejevs  
View profile  
 More options Oct 29 2012, 8:42 am
From: Aldis Andrejevs <andrej...@gmail.com>
Date: Mon, 29 Oct 2012 05:42:02 -0700 (PDT)
Local: Mon, Oct 29 2012 8:42 am
Subject: getting html source code from website

Hi all, I have one question:

====================================
package main

import (
"fmt"
"net/http"
"io/ioutil"
)

func main() {
res, _ := http.Get("http://www.yahoo.com/")
html, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
fmt.Printf("%s", html)

}

=========================================

this is program which I compile under LinuxOS and under WindowsOS code is
the same for both operating systems

but on WindowsOS I don't receive source code however under LinuxOS all
works as expected

maybe someone knows solution for this ?

thanks..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Gillette  
View profile  
 More options Oct 29 2012, 11:27 am
From: Kevin Gillette <extemporalgen...@gmail.com>
Date: Mon, 29 Oct 2012 08:27:53 -0700 (PDT)
Local: Mon, Oct 29 2012 11:27 am
Subject: Re: getting html source code from website

Check the errors from http.Get and ioutil.ReadAll. Chances are, there's
some issue on windows which is being reported, but which you're explicitly
ignoring. By the way, any time you show code using blanked errors anywhere
within the Go community, you'll invariably be advised to not ignore them,
even if it has nothing to do with the problem (though in this case, I
believe it does).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gofans...@gmail.com  
View profile  
 More options Oct 29 2012, 1:04 pm
From: gofans...@gmail.com
Date: Mon, 29 Oct 2012 10:04:58 -0700 (PDT)
Local: Mon, Oct 29 2012 1:04 pm
Subject: Re: getting html source code from website

i ran your code on my windows machine and got the expected html.
so your code worked in my environment.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dumitru Ungureanu  
View profile  
 More options Oct 29 2012, 1:49 pm
From: Dumitru Ungureanu <itmit...@gmail.com>
Date: Mon, 29 Oct 2012 10:49:24 -0700 (PDT)
Local: Mon, Oct 29 2012 1:49 pm
Subject: Re: getting html source code from website

It's working on my Win.

If I had to guess, I'd say it has something to do with the online security
on your Win machine. Are you able to open http://www.yahoo.com/ in a
browser on that machine?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joshua  
View profile  
 More options Oct 29 2012, 3:24 pm
From: Joshua <jhaw...@gmail.com>
Date: Mon, 29 Oct 2012 12:24:14 -0700 (PDT)
Local: Mon, Oct 29 2012 3:24 pm
Subject: Re: getting html source code from website

I notice that when I try to run the code on my Windows box behind a proxy,
it fails (with no errors).

Joshua


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Miki Tebeka  
View profile  
 More options Oct 29 2012, 7:17 pm
From: Miki Tebeka <miki.teb...@gmail.com>
Date: Mon, 29 Oct 2012 16:17:25 -0700 (PDT)
Local: Mon, Oct 29 2012 7:17 pm
Subject: Re: getting html source code from website

What are the HTTP headers returned?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »