Search the Community
Showing results for tags 'soap'.
-
I'm a student/Intern at an Agency and I was asked to test an HTTP request to a server using a code given in the servers doc which goes like this : <?php $client = new httpClient; $request = new http\Client\Request; $body = new http\Message\Body; $body->append(' <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <WebServiceDiva xmlns="http://www.Divalto.fr/WebService/"> <action><action>WP_CREATECLI</action> <param> {licence:"XXXXX=",client: {"dos":"2","nom":"Alex Xela","adr1":"53 Bd Carnot","adr2":"","adr3":"","adr4":"","cpostal":"06400","vil":"Cannes","tel":"053837979","email":"[email protected]","siret":"","naf":"","regcod":"CB","tvatie":"0","catclicod":"","tacod":"","tarcod":"","blmod":"DPD","texcod1":"","texcod2":"","texcod3":"","texcod4":"","tvano":"","visa":"2"},adresse: {"nom":"Alex Xela","adr1":"53 Bd Carnot","adr2":"","adr3":"","adr4":"","cpostal":"06400","ville":"","tel":"053837979","email":"[email protected]","livprincipale":"2","facprincipale":""},contact: {"contact":"Customer","nom":"Alex Xela","prenom":"","tit":"","lib":"","tel":"","telgsm":"","fax":"","email":"[email protected]","servcod":"","fctcod":""},banque: {"ribcod":"","ribdo":"","iban1":"","iban2":"","iban3":""}} </param> </WebServiceDiva> </soap:Body> </soap:Envelope> '); $request->setRequestUrl('https://divaltosainteroseline.coaxis.com/WebServiceDiva/WebServiceDiva.asmx'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders(array( 'accept-encoding' => 'gzip', 'content-type' => 'text/xml' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ?> The problem is I can't even get throught the first lines when I execute the code, It says that there is no class Http\Client or Http\Client\Message or Http\Client\Request. and I looked for these classes in php doc but couldn't find anything. also after 3 days of research I only found SaopClient and SoapCall Classes that really treat HTTP and SOAP communication but the tech guy at the server company tells me that this is the way to connect using php and I'm completely lost and need ur help
-
Good morning guys. I am pulling data from vehicle tracking site via soap curl. but the data format that I am getting it in is unusable, maybee i am doing something wrong. please have a look. here is the code. <?php //Data, connection, auth $dataFromTheForm = $_POST['fieldName']; // request data from the form $soapUrl = "https://fleet11.******.co.za/api/"; // asmx URL of WSDL $soapUser = "********"; // username $soapPassword = "********"; // password // xml post structure $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="fleet11.cartrack.co.za/api/"> <soapenv:Header/> <soapenv:Body> <api:endpoint.get_vehicle_last_positions soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <username xsi:type="xsd:string">?</username> </api:endpoint.get_vehicle_last_positions> </soapenv:Body> </soapenv:Envelope>'; $headers = array( "Content-type: application/x-www-form-urlencoded", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: fleet11.******.co.za/api/#get_vehicle_last_positions", "Content-length: ".strlen($xml_post_string), ); $url = $soapUrl; // var_dump($url); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); `curl_setopt($ch, CURLOPT_HEADER, true);` // converting $response = curl_exec($ch); curl_close($ch); //paul add //echo "<pre>"; print_r($response); What is returning is single line entries How di i get this into a format to import into mysql