Jump to content

timothee

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

timothee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I need to install DIO to control the serial port of my server with PHP. The docs says DIO was moved to PECL but installation via PECL tells me no such package exists. I'm using PHP 5.1.6 on Gentoo 2006.1. What should I do to get DIO running? Thanks, Tim.
  2. Hi all, I need to control a device connected to the serial port of my server but I'm not sure how to proceed. Would anyone have a simple sample of talking to the serial port from linux in php? I've searched around a little bit and apparently I need the dio extension. However the php.net site states that the extension is only available on windows from 5.1.0 (I'm on linux/Apache2/PHP5.1.4). Is there anyway to install it on linux anyway or is there an alternative solution to talk to the serial port? Maybe via fopen/fread/fwrite on /dev/ttyS0? I tried that without success, but I'm really not sure I did it the right way. Thanks in advance for any help! Tim.
  3. Hi there, Sorry this must be a dumb question but how do I install the dio extension from pecl? a straight: [code]#pecl install dio[/code] returns [code]No releases available for package "pecl.php.net/dio" Cannot initialize 'dio', invalid or missing package file Package "dio" is not valid install failed [/code] And it seems there is no release at all to download at [a href=\"http://pecl.php.net/package/dio\" target=\"_blank\"]http://pecl.php.net/package/dio[/a]. I'm on gentoo 2006.0 with php 5.1.4 Thanks, Tim.
  4. Hi all, Using PHP5.1.4, is there any way to enable automatic validatation of values passed to match the datatype defined in the wsdl? I hit the case below: based on a wsdl, I must send a couple of date parameters (type is xsd:date). When I format my parameters according to specs (YYYY-MM-DD), the request goes correctly. However if I mistakenly send non-conformant data (e.g. a string as "fooYYYY-MM-DDbar"). Neither the soapclient nor the soapserver complain that the data format is invalid and of course my request doesn't return meanigful results. What I was expecting to see was the soapserver, at least, taking care of the data format validation and throw a soap fault should the format not match. What gives? Thanks, Tim.
  5. Never mind, David Kingma, the author of [a href=\"http://jool.nl/new/1,webservice_helper.html\" target=\"_blank\"]WSHelper[/a] pointed out my very dumb mistake: in PHP classes, I must refer to the current instance explicitely when calling methods: this->connect() instead of just connect(). Sorry for the noise. Tim.
  6. Hi all, I'm trying to create a webservice by using a class but I have some problems with sharing redundant code. I thought I could create private methods in my class to share the common code without exposing the function in the webservice but that is not working :(. Is there a way to achieve this? Here is my sample webservice class. The method, I'd like to share is "connect". [code] <?php require_once('DB.php'); require_once($_SERVER["DOCUMENT_ROOT"]."/page_tracker/config.inc.php"); /** * retrieve hit count for pages, or IDs, over specified period of time */ class PageTrackerWS { private $connected = false; private $db; /** * Initializes connection to the DB * @return void */ private function connect() { if ($connected) return; global $config; $db = DB::Connect($config['dsn']); if (DB::isError($db)) { throw new Exception($db->getUserInfo()); } $db->setFetchMode(DB_FETCHMODE_ASSOC); $connected = true; } /** * Returns a list of all page that are marked for tracking * @return string[] */ public function getTrackedPages() { try { connect(); $db->setFetchMode(DB_FETCHMODE_ORDERED); $req = $db->query("SELECT URI from URIS"); if (DB::isError($req)) throw new Exception($req->getUserInfo()); while ($row = $req->fetchRow()) { $ret[] = $row[0]; } return $ret; } catch(Exception $e) { // !! TODO // return Fault here } } /** * Returns the internal ID of a tracked page * @param string $uri The uri * @return string */ public function getPageID($uri) { try { connect(); $ID = $db->getOne("SELECT ID from URIS WHERE URI=?", array($uri)); if (DB::isError($ID)) throw new Exception($ID->getUserInfo()); return $ID; } catch(Exception $e) { // !! TODO // return Fault here } } } ?> [/code] Here is the code I use to test my service [code] $client = new SoapClient("http://localhost/wshelper/service.php?class=PageTrackerWS&wsdl"); $pages = $client->getTrackedPages(); foreach ($pages as $page) echo $page."<br/>"; [/code] And the error I get: [code] Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Call to undefined function connect() in /var/www/localhost/htdocs/page_tracker/WSTest.php:14 Stack trace: #0 [internal function]: SoapClient->__call('getTrackedPages', Array) #1 /var/www/localhost/htdocs/page_tracker/WSTest.php(14): SoapClient->getTrackedPages() #2 {main} thrown in /var/www/localhost/htdocs/page_tracker/WSTest.php on line 14 [/code] To assist me in managing my Web Service, I am using the [a href=\"http://jool.nl/new/1,webservice_helper.html\" target=\"_blank\"]WSHelper[/a] tool from jool.nl. Could that be causing problems? Thanks in advance, Tim.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.