make genproxy.php easier to use as a command

From: Date: Tue, 24 Jun 2003 15:05:00 +0000
Subject: make genproxy.php easier to use as a command
Groups: php.soap 
Request: Send a blank email to php-soap+get-727@lists.php.net to get a copy of this message
A couple of changes that would make tools/genproxy.php easier to use as a command: 1. Add "#! /usr/bin/php -q" as a first line. 2. Give the file execute permission (chmod +x) in the distribution. Then, users will be able to invoke the tool by $ /usr/lib/php/SOAP/tools/genproxy.php ... instead of the more awkard $ /usr/bin/php -q /usr/lib/php/SOAP/tools/genproxy.php ... As it stands now, if you invoke it by /usr/bin/php *without* the -q, and your application is a client command, you get HTTP response cruft out at the start, even if your command uses -q. Example: $ cat ws-temp.php #!/usr/bin/php -q <?php include("./temperature.php"); if ($argc != 2) { exit("You must supply a zip code! \n"); } $zip = $argv[1]; $wst = new WebService_TemperatureService_TemperaturePort(); $temp = $wst->getTemp($zip); print "The current temperature for zip code $zip is $temp degrees F. \n"; ?> $ /usr/bin/php /usr/share/php/SOAP/tools/genproxy.php http://www.xmethods.net/sd/2001/TemperatureService.wsdl > temperature.php $ ./ws-temp.php 07746 X-Powered-By: PHP/4.2.2 <=== cruft Content-type: text/html <=== cruft The current temperature for zip code 07746 is 82 degrees F. For those non-Unix-Linux platforms that don't support the "#!" syntax, they can modify it to whatever they need ... but making these changes will get the most common case of the tool's usage to work better. Jonathan Schilling

« previous php.soap (#727) next »