Looking for php example code

Discussion in 'Developers Forum' started by Peter Bowen, Nov 11, 2008.

Thread Status:
Not open for further replies.
  1. Peter Bowen New Member

    Greetings,

    I'm hoping that someone is kind enough to share an example of a php API integration. It's always much faster to get started on standing on the shoulders of giants.

    Cheers

    Pete
  2. Peter Bowen New Member

    I figured out I'd have to just battle it out myself.

    So here is my first attempt at retrieving an invoice.

    PHP:
    <?php
    //this is test-kf.php

    $client = new SOAPClient("https://secure.kashflow.co.uk/api/service.asmx?WSDL");
        
    $invoice $client->__soapCall('GetInvoice',array('Username'=>'xxxx','Password'=>'xxx','InvoiceNumber'=>'1'));
        
    print_r($invoice);
        
    ?>
    It's connecting fine but doesn't authenticate me? I've done the obvious and rechecked the username and password combo.

    Here is the error message

    stdClass Object ( [GetInvoiceResult] => stdClass Object ( [InvoiceDBID] => 0 [InvoiceNumber] => 0 [InvoiceDate] => 0001-01-01T00:00:00 [DueDate] => 0001-01-01T00:00:00 [CustomerID] => 0 [Paid] => 0 [Lines] => stdClass Object ( ) [NetAmount] => 0 [VATAmount] => 0 [AmountPaid] => 0 ) [Status] => NO [StatusDetail] => An exception occured whilst trying to authenticate you. String reference not set to an instance of a String. Parameter name: s )

    I've tried all the combinations of UserName and InvoiceNumber vs InvNumber as shown in the manual and the example code with no luck.

    Any ideas?

    Cheers

    Pete
  3. DuaneJackson Administrator

    Hi Pete,

    For show stopping erros like this you should contact us on support AT or api AT kashflow.co.uk.

    Tomorrow I'll be able to edit the API to give more detail with that error, then when you get the error again you'll have more detail to send us which should allow us to fix it.
  4. Peter Bowen New Member

    Thanks Duane,

    I'll do that next time. Waint - hopefully there won't be a next time.

    Cheers

    Pete
  5. DuaneJackson Administrator

Thread Status:
Not open for further replies.

Share This Page