469,949 Members | 2,680 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,949 developers. It's quick & easy.

Getting the source of a remote webpage

Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I just want
to write a simple script if possible) and write it to a file? For
example, is it possible to do something like os.system(....run
iexplorer.exe command....) with another command that automatically
opens the page? Thanks.

Ryan Kaskel
Jul 18 '05 #1
3 1567
On Wed, 23 Jun 2004 19:47:02 -0700, Ryan Kaskel wrote:
Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I just want
to write a simple script if possible) and write it to a file? For
example, is it possible to do something like os.system(....run
iexplorer.exe command....) with another command that automatically
opens the page? Thanks.


import urllib

f = urllib.urlopen(url)
s = site.read()


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 18 '05 #2
In article <pa****************************@newsfeeds.com>, Nugget wrote:
Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I
just want to write a simple script if possible) and write it
to a file? For example, is it possible to do something like
os.system(....run iexplorer.exe command....) with another
command that automatically opens the page? Thanks.


import urllib

f = urllib.urlopen(url)
s = site.read()


least we lead the gentle reader astray...
import urllib
f = urllib.urlopen('http://www.visi.com')
s = site.read()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'site' is not defined

What you meant was:
s = f.read()
print s

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
[...]

--
Grant Edwards grante Yow! ... A housewife
at is wearing a polypyrene
visi.com jumpsuit!!
Jul 18 '05 #3
Nevermind....a simple look in the Standard Library gave me the simple
solution I needed....
ry**@ryankaskel.com (Ryan Kaskel) wrote in message news:<69**************************@posting.google. com>...
Is it possible to get the source of a remote webpage (just the
straight HTML) without anything too complicated (like COM, I just want
to write a simple script if possible) and write it to a file? For
example, is it possible to do something like os.system(....run
iexplorer.exe command....) with another command that automatically
opens the page? Thanks.

Ryan Kaskel

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Ryan Kaskel | last post: by
2 posts views Thread by Deepson Thomas | last post: by
9 posts views Thread by =?Utf-8?B?UmF5?= | last post: by
3 posts views Thread by =?GB2312?B?zPC5zw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.