0

I try to make a SOAP request:

$soapclient = new SoapClient('http://www.moviestarplanet.fr/WebService/ThirdParty/ThirdPartyService.asmx?wsdl');
$params = array('username' => 'string', 'password' => 'string');
$response = $soapclient->Login($params);
var_dump($response);

but an error telling me:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.moviestarplanet.fr/WebService/ThirdParty/ThirdPartyService.asmx?wsdl' : failed to load external entity[...]

I searched for a long time on the net, but I haven't found any solution... Anyone can help me, please? Thanks!

Pierre-Louis
  • 17
  • 1
  • 6
  • Do you have `allow_url_fopen=On` in php.ini ? Thats just first came into my mind. Also check here: http://stackoverflow.com/questions/12875409/soap-php-fault-parsing-wsdl-failed-to-load-external-entity – Alexey Chuhrov Sep 11 '16 at 15:41
  • Thanks for your help. Yes I have `allow_url_fopen=On` and your link didn't help me... I'm very lost... – Pierre-Louis Sep 11 '16 at 16:12

1 Answers1

-1

I have found the solution !

<?php
$xml_data = '
<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:Header>
    <ThirdPartyTokenHeader xmlns="http://moviestarplanet.com/">
      <ThirdPartyToken>8346D304-F85E-4dc1-98EB-033CBEE0217F</ThirdPartyToken>
    </ThirdPartyTokenHeader>
  </soap:Header>
  <soap:Body>
    <Login xmlns="http://moviestarplanet.com/">
      <username>USER</username>
      <password>PASS</password>
    </Login>
  </soap:Body>
</soap:Envelope>
';

$headers = array(
"POST /WebService/ThirdParty/ThirdPartyService.asmx HTTP/1.1",
"Referer: www.moviestarplanet.fr",
"User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; GT-I9505 Build/KOT49H)",
"Content-Type: text/xml; charset=utf-8",
"Host: www.moviestarplanet.fr",
"Content-length: ".strlen($xml_data),
"Expect: 100-continue"
);

$url = 'http://www.moviestarplanet.fr/WebService/ThirdParty/ThirdPartyService.asmx?WSDL';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);

$reply = curl_exec($ch); 

echo($reply);
?>
Pierre-Louis
  • 17
  • 1
  • 6