xml - Convert a VBS script to PHP -


i have been given example piece of code company i'm dealing how post xml data url read response. unfortunately me in vbs don't have working knowledge of:

this section of code i'm interested in. should pass on xml file read in oxml post , read response:

set ohttp = createobject("microsoft.xmlhttp") ohttp.open "post", "http://www.ophub.net/opxml/response.asp", false,00092,qw 'file url - dealers account number, password ohttp.setrequestheader "content-type", "application/x-www-form-urlencoded" ohttp.setrequestheader "content-length", len(srequest) ohttp.send oxml 

from understand of in php can done curl , have come following bits have read online doesn't work , i'm not sure why.

$ch = curl_init(); curl_setopt($ch, curlopt_httpheader, array("content-type: application/x-www-form- urlencoded")); curl_setopt($ch, curlopt_url, "http://www.ophub.net/opxml/response.asp"); curl_setopt($ch, curlopt_userpwd, "00092:qw"); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, "xml=" . $xml); $content=curl_exec($ch); echo $content; 

i'm sure can't far off need can't seem there hep appreciated.

in post fields set xml no need set xml=

curl_setopt($ch, curlopt_postfields, $xml); 

you need return transfer true

curl_setopt($ch, curlopt_returntransfer, true); 

Comments