Can you help me to convert the following Python code to PHP - Many Thanks

This is a discussion on Can you help me to convert the following Python code to PHP - Many Thanks within the PHP General forums, part of the PHP Programming Forums category; import urllib import urllib2 from xml.dom import minidom user="YourUserName" password="YourPassword" site='https://test....


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-23-2007
wnjayantha@yahoo.com
 
Posts: n/a
Default Can you help me to convert the following Python code to PHP - Many Thanks

import urllib
import urllib2
from xml.dom import minidom

user="YourUserName"
password="YourPassword"

site='https://test.api.betfairgames.com/rest/v1/bet/order'
site=site+"?username="+user

xml_request1="""<postBetOrder
xmlns="https://api.betfairgames.com/rest/v1"
round="1" marketId="3829306" currency="GBP">
<betPlace>
<bidType>BACK</bidType>
<price>2.6</price>
<size>4</size>
<selectionId>658439</selectionId>
</betPlace>
</postBetOrder>"""

values = {'xmlRequest':xml_request}
data=urllib.urlencode(values)

req=urllib2.Request(site)
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
req.add_header('gamexAPIAgent','maryBrown@AOL.com. myGames.4.0')
req.add_header('gamexAPIAgentInstance','0d69ee8290 ee2f9b336c1f060e3497a5')
req.add_header('gamexAPIPassword',password)
req.add_header('Keep-Alive','300')
req.add_header('Proxy-Connection','keep-alive')
req.add_header('Content-Type','application/x-www-form-urlencoded')
req.add_header('Content-Length',str(len(data)))
req.add_data(data)

xmlresult = urllib2.urlopen(req)
xmlparser = minidom.parse(xmlresult)

print xmlparser.toxml()

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:58 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0