command to update a web page

A

atabhcy

Hello All,
I have a python script which sends out email once a particular
condition is met. Now I want to extend the functionality and make this
script update a php web page with the same contents as those of the
emails it sends out.
What module /commands can help me acheive this?
Thanks.
 
L

Larry Bates

You probably just want to use ftplib to upload the new
page to the website. You will, of course, need to create
the new page from the information provided by whatever
condition triggered it prior to uploading to the server.

Alternatively you could update some information in a
MySQL database and have your php web page access that
information every time it refreshes. The database
would need to be hosted at the website (but most ISPs
now give you free MySQL anyway).

Sort of depends on how often this happens, how complex
the php page is, etc. as to which is best method.

Larry Bates
 
N

ncf

I can't begin to know too much about this subject, but Python has a
builtin httplib module which might be interesting to you. There is also
a ftplib if that is how you want to do it. Python's documentation seems
to have adequate examples on how to use the two modules.

-Wes
 
A

atabhcy

Thanks
I used the httplib module to establish and test a connection now the
next step is to login supplying a username and password.
Any examples of these available somewhere
This is what i have so far
import httplib, urllib
conn = httplib.HTTPConnection("xxx.xx.xx.xxx")
conn.request("GET", "/index.php")
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,200
Members
47,840
Latest member
Tiffany471

Latest Threads

Top