/** * @param $xmlData * * @return array */ public static function getArrayFromXML($xmlData) { require_once 'Google/library/xml-processing/gc_xmlparser.php'; $xmlParser = new gc_XmlParser($xmlData); $root = $xmlParser->GetRoot(); $data = $xmlParser->GetData(); return array($root, $data); }
function getError() { if ($this->error[0] != 'CURLERR') { $xml_parser = new gc_XmlParser($this->error[1]); $data = $xml_parser->GetData(); $error = $data['error']['error-message']['VALUE']; } else { $error = $this->error[1]; } return array('status_code' => $this->error[0], 'message' => $error); }
function RequestToken() { $this->request_token_xml = $this->GetTokenRequestXML(); //create GRequest object + post xml (googlecart.php line: 962) require_once 'library/googlerequest.php'; $GRequest = new GoogleRequest($this->merchant_id, $this->merchant_key); /*---------------------------------------------------------------------------------------------------*/ $GRequest->SetCertificatePath("/etc/ssl/certs/ca-certificates.crt"); $this->token_response_xml = $GRequest->SendReq($this->server_url, $GRequest->GetAuthenticationHeaders(), $this->request_token_xml); //Check response code if ($this->token_response_xml[0] == "200") { require_once 'xml-processing/gc_XmlParser.php'; $GXmlParser = new gc_XmlParser($this->token_response_xml[1]); $data = $GXmlParser->GetData(); $this->continue_token = $data['notification-data-token-response']['continue-token']['VALUE']; return $this->continue_token; } else { return false; } }