In the ABN webservice, need to get the ABN/ACN number using name search.

I used the below code for search by name. But it returns an error.
PHP Fatal error:  Call to undefined method stdClass::externalNameSearch() in /home/kaybsoln/public_html/ on line 43


 * @author Justin Swan - 16 August 2012
 * extends php soap client to utilize the Australian Government ABN Lookup web service 
 * requires php 5 or greater with lib-xml enabled/compiled in Apache, see the PHP manual for further requirements info
 * @link
 * @link
 * @param string $guid - get a guid id by registering @
class abnlookup extends SoapClient{
    private $guid = "******************************"; 
    public function __construct($guid)
        $this->guid = $guid;
        $params = array(
            'soap_version' => SOAP_1_1,
            'exceptions' => true,
            'trace' => 1,
            'cache_wsdl' => WSDL_CACHE_NONE
        parent::__construct('', $params);
   public function searchByAbn($abn, $historical = 'N'){
		$params = new stdClass();
		$params->searchString				= $abn;
		$params->includeHistoricalDetails	= $historical;
		$params->authenticationGuid			= $this->guid;
		return $this->ABRSearchByABN($params);

  public function searchByName($company_name){
        $params = new stdClass();
        $params->authenticationGuid            = $this->guid;
        return $this->ABRSearchByName($params);
$company_name = "A. & G. PTY LTD";
$abn_search_string = "74599608295"; // you can assign your post/get var or abn string here

    $abnlookup = new abnlookup($abn_guid);
        $result = $abnlookup->searchByName($company_name); 
        // display all results
        echo "<pre>";
        echo "</pre>";
        // also display by variables using object notation.
        echo "<pre>";
        echo "</pre>";
    } catch    (Exception $e){
        throw $e;
} catch(Exception $e){
    echo $e->getMessage();

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
The error on line 43 occurs because PHP StdClass does not have any built-in methods.

PHP support for SOAP is pretty lame, and almost nobody uses SOAP any more.  The preferred method of data interchange today is REST and JSON.  If you absolutely have to use SOAP, you have my sympathy and you have a lot of hard work and painful debugging ahead of you!  But before you go down that horrible road, contact the Australian government and find out if they have a REST interface for this data.  Even if it returns XML it will be better than SOAP.  The government may have working code examples you can use to get started (the code sample with this question could never have run at all).

General information on how modern APIs work:



HTH, ~Ray

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.