PHP Function return values from XML or XS file

eremejar

New Member
how to pass this xml function parameters into this PHP Function parameters .the xml function which connect to my server and its WORKING 100% and the code is\[code\]<?phperror_reporting(E_ALL);ini_set('display_errors', 'On');$xml_request = '<DOMAPI xsi:schemaLocation="https://api.101domain.comapi.xsd"xmlns="https://api.101domain.com">'.'<Request>'.'<Login>'.'<id>60</id>'.'<Key>abc123</Key>'.'</Login>'.'<ContactCreate requestId="1"><FirstName>Some</FirstName><LastName>Guy</LastName><Company>Corporate Thingie</Company><Email>[email protected]</Email><Address1>5858 Edison Pl</Address1><City>Carlsbad</City><State>CA</State><Postal>92108</Postal><Country>US</Country><Phone cc="1" ext="1003">7607363700</Phone></ContactCreate>'.'<Register requestId="2">'.'<Domain>PROPERTYFINDERRENTAL.ae</Domain>'.'<Period>12</Period>'.'<Trustee>false</Trustee>'.'<Contacts> <Registrant> <id>7FFE4</id> </Registrant> <Admin> <Contact> <FirstName>Some</FirstName> <LastName>Guy</LastName> <Company>Corporate Thingie</Company> <Email>[email protected]</Email> <Address1>5858 Edison Pl</Address1> <City>Carlsbad</City> <State>CA</State> <Postal>92108</Postal> <Country>US</Country> <Phone cc="1" ext="1003">7607363700</Phone> </Contact> </Admin> <Technical> <id>7FFE4</id> </Technical> </Contacts>'. '<NameServers>'. '<Host>ns1.101domain.com</Host>'. '<Host>ns2.101domain.com</Host>'. '</NameServers>'. '<Fields> <Field> <Name>org-type</Name> <Value>org</Value> </Field> </Fields> </Register> </Request> </DOMAPI>'; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, "https://api.101domain.com/do"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_request); $xml_response = curl_exec($ch); echo $xml_response; ?>`\[/code\]with this eml request i successfully register a domain with the server,but i want to integrate this XML above in this php function below\[code\]`function template_RegisterDomain($params) {$username = $params["Username"];$password = $params["Password"];$testmode = $params["TestMode"];$tld = $params["tld"];$sld = $params["sld"];$regperiod = $params["regperiod"];$nameserver1 = $params["ns1"];$nameserver2 = $params["ns2"];$nameserver3 = $params["ns3"];$nameserver4 = $params["ns4"];# Registrant Details$RegistrantFirstName = $params["firstname"];$RegistrantLastName = $params["lastname"];$RegistrantAddress1 = $params["address1"];$RegistrantAddress2 = $params["address2"];$RegistrantCity = $params["city"];$RegistrantStateProvince = $params["state"];$RegistrantPostalCode = $params["postcode"];$RegistrantCountry = $params["country"];$RegistrantEmailAddress = $params["email"];$RegistrantPhone = $params["phonenumber"];# Admin Details$AdminFirstName = $params["adminfirstname"];$AdminLastName = $params["adminlastname"];$AdminAddress1 = $params["adminaddress1"];$AdminAddress2 = $params["adminaddress2"];$AdminCity = $params["admincity"];$AdminStateProvince = $params["adminstate"];$AdminPostalCode = $params["adminpostcode"];$AdminCountry = $params["admincountry"];$AdminEmailAddress = $params["adminemail"];$AdminPhone = $params["adminphonenumber"];# Put your code to register domain here (HERE i want to use the xml request above )###If error, return the error message in the value below$values["error"] = $error;return $values;}`\[/code\]any idea on how to use simplexml to include the xml request into for of php function using the parameters ?any idea or key will be helpful for me . thank sharing
 
Back
Top