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