Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SOAP request

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);
}
like image 334
Bobby Avatar asked Aug 05 '26 12:08

Bobby


1 Answers

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

like image 125
Wrikken Avatar answered Aug 08 '26 03:08

Wrikken



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!