Hello.
I have a python script to post news a website but i want to know how i can pass variables from php to the python script and run the script from php.
Python script: (I didn't create this, was done by a friend)
import urllib2, urllib
USER = '' # Put your username within the quotes
PASS = '' # Put your password within the quotes
URL = 'http://steamcommunity.com/groups/<groupid>/announcements' # Change this to the url of the page where you post an announcement on your steam group
TITLE = '' # News header
MESSAGE = '' # news body
# build opener with HTTPCookieProcessor
o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
urllib2.install_opener( o )
# Build the url for login
p = urllib.urlencode( { 'action' : 'doLogin', 'steamAccountName': USER, 'steamPassword': PASS } )
# perform login with params
f = o.open( 'https://steamcommunity.com/', p )
data = f.read()
f.close()
# second request should automatically pass back any
# cookies received during login... thanks to the HTTPCookieProcessor
# Send the post
p = urllib.urlencode( { 'action' : 'post', 'headline' : TITLE, 'body' : MESSAGE } )
f = o.open( URL, p )
data = f.read()
f.close()
Any help is much appreciated :)
Thanks