$ch = curl_init ($url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,"clecID=150&request=".$xml); //$xml is the xml string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_NOPROGRESS, 0); $result = curl_exec ($ch); $xmlFlags = 0; $this->xml_parser = xml_parser_create(); xml_set_object($this->xml_parser, $this); xml_set_element_handler($this->xml_parser, "startElement", "endElement"); xml_set_character_data_handler($this->xml_parser, 'elementContent'); if (!xml_parse($this->xml_parser, $result)) { $this->failed=true; } xml_parser_free($this->xml_parser); function startElement($parser, $name, $attrs) {global $xmlFlags; if($name=="CUSTOMERPAYMENTID") $xmlFlags = 1; if($name=="ERROR") $this->failed=true;} function elementContent($parser, $data) {global $xmlFlags; if($xmlFlags==1){ $this->confirm = $data; $xmlFlags = 0;}} function endElement($parser, $name) { } write_log("['.$this->confirm.']");