10.6 Web Services from PHP

Setting up AMFPHP for web services is covered in Chapter 9. There are two web service options for AMFPHP: nuSOAP and PEAR::SOAP. The examples should work with either. The AMFPHP gateway requires that web services be called with the arguments attached to an ActionScript object. The Whois web service described earlier requires these three named arguments:

SRLFile

The name of the Service Request Language File ("WHOIS.SRI" for domain checking).

RequestName

This should always be "whois".

Key

The domain name.

Other than that, the code can be used as-is from the ColdFusion MX example, substituting your own Flash Remoting gateway URL. The getWhois( ) function looks like this in the PHP example:

function getWhois ( ) {
  myService.ProcessSRL({
    SRLFile:"WHOIS.SRI",
    RequestName:"whois",
    Key:domain_txt.text});
}

In the function, we are simply creating a generic object in the function call.



    Part III: Advanced Flash Remoting