PHP and Web API

Good Afternoon

We have a new web developer who is creating a new signup form for one of our consortium partners websites.  They currently work in PHP and being a .net person i have no idea how PHP works (tried it once but never again!).  Does anyone have any examples of how to get PHP to connect to the web API and what method they have used to consume the XML?  If you could that would be a life saver!

Thanks

Nick

  • I have no direct experience with this, though I have done a lot of PHP programming in the past.  Here's a link to a site that illustrates some examples and methods on how to consume a Web service with PHP:

    http://webservices.xml.com/pub/a/ws/2004/03/24/phpws.html

    You should convince them to learn .NET though... You can then maintain one standard on your site, which helps for maintenance, plus it's just so much easier to do this kind of thing, especially with the newer versions of .NET!

     

     

  • If you look on footprints for the Wordpress solution.  There I am using the web api in php to make calls to login users and check there login status.    In the zip file look in the following folder

    wp-content\themes\McCarter  at the header.php.  There I am making the php calls to the web api.  Also the mcc-config.php  in the same folder has a few varibles defined.

    Let me know if you need anymore assistance with this.

    Jon

  • Hi Nick,

    Using PHP to connect to the Tessitura web API is very simple.
    Handling the XML is easy, too. Here's an example using GetLocalData:



    /* Open a connection to the SOAP server */
    $client = new SoapClient("https://webapi.yourdomain.org/Tessitura_API/
    Tessitura.asmx?WSDL");

    /* Put method parameters in an array */
    $params = array("SessionKey"=>$session, "LocalDataTableIndex"=>1,
    "RetrievalKey"=>$customer);

    /* Get response from SOAP server */
    $response = $client->GetLocalData($params);

    /* Parse the results into an XML object */
    $XML = simplexml_load_string($response->GetLocalDataResult->any);

    /* See what you've got */
    print_r($XML);

    ?>

    Obviously you'll need to add in some error checking, etc. But this
    should be able to get you started. You can find good documentation on
    these functions at www.php.net. (http://us.php.net/manual/en/
    book.soap.php)

    Let me know if you have anymore questions.

    -Morgan
  • Nice one thanks.  I will pass this info on to our developers.

    I really don't get PHP so very useful!

    Thanks

    Nick

  • Hi Nick,

    We have just had a new site developed in PHP that uses the Tessitura API (www.abbeytheatre.ie).

    Our development company used a PHP client called "Zend" that I gather took care of all the SOAP interaction with the Tessitura API and has built in functionality for SOAP compression.

    I'm afraid I don't have any more detail on this but hope it is of some use to you.

    cheers,

    Dara

  • Hi all, I'm receiving this weird soap error:

     

    Uncaught SoapFault exception: [HTTP] Unknown Content-Encoding

     

    Any idea what this means? Google provides no help with this particular error. I'm new to soap and the web api so any help getting me pointed in the right direction would be greatly appreciated!

    Thanks.

     

     

  • Hi Josh,

    Sounds like it could be a problem decoding the SOAP.

    Have you tried turning SOAP compression off and see if it works? 

  • Hi Dara, and thanks.

    I have tried it with compression disabled and still no luck. I've been stuck on this for what seems like weeks now. 

    I've downloaded SoapUI and that successfully communicates with the API via SOAP but for some reason I can't seem to get past this soap expression in PHP.

    Anyone have ideas or other debugging tools to recommend? 

    Thanks for your help!

  • Josh,

    We're you able to solve your encoding problem?  We seem to be experiencing the same thing on a new site built with php.

    Thanks

    Michelle