3

I am working on an API Script for a client, and one of the services they need the request made to wants the content length. As far as I was aware, PHP cannot send the Content-Length in the header. I could be wrong but, without it, I keep getting Premature end of data in tag html line 3 [string:Exception:private] => [code:protected] => 0 [file:protected] =>

The code looks as follows:

<?
try
{
    $soap_url = 'http://admin.stock.imdfulfilment.com/api/service.asmx';
    $client = new SoapClient($soap_url);

    $header = new SoapHeader(

        'http://admin.stock.imdfulfilment.com/api/service/',
        'GetCouriers',
        array(
            'Content-Length' => '255'
        )
    );
    $client->__setSoapHeaders($header);
    var_dump($client->__getFunctions());
}
catch (Exception $e)
{
   print_r($e);
}
hakre
  • 193,403
  • 52
  • 435
  • 836
Bobby
  • 4,332
  • 5
  • 32
  • 39

1 Answers1

10

Your wsdl uri doesn't serve a wsdl file, that is the problem...Use http://admin.stock.imdfulfilment.com/api/service.asmx?wsdl

Wrikken
  • 69,272
  • 8
  • 97
  • 136