SV: [PHP] PHP vs Servlet

From: Date: Sun, 25 Mar 2001 10:52:11 +0000
Subject: SV: [PHP] PHP vs Servlet
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45478@lists.php.net to get a copy of this message
Okey, sorry about that. Communicating with a servlet via http is not different from other php-http-methods: For example: # First declare some parameters which shall be sent to the Servlet/JSP $eqid = '1'; $oparameter = 'tablist'; $nocolumn = '1'; $request = '?eqid=' . urlencode($eqid); $request .= '&oparameter=' . urlencode($oparameter); $request .= '&nocolumn=' . urlencode($nocolumn); # Then it is just a simple as reading a file via http (NOTE! the client does not care whether it is a file or a stream) # To be able to access the server I must also submit a userId and a pwd. $elements = file("http://userid:pwd@xxx.partitur.se/servlets/XQuery".$request); Then all you have to do is to iterate the returned array (there are many way ie: for ($i = 0; $i < sizeof($elements); $i++)). If you want to split the stream with a RE you can try to use a method like this one: function readandsplit($filename, $separator) { $fd = fopen($filename, "r"); $contents = ""; $chunksize = 1000; do { $tmpstr = fread ($fd, $chunksize); $contents = $contents.$tmpstr; } while (strlen($tmpstr) == $chunksize); fclose($fd); # And for example use the preg_split-method which takes the RE and splits the string $elements=preg_split($separator, $contents); return($elements); } By from Stockholm, Sweden! / Jeppe Krznaric Michael <mkrznaric@rand.com> skrev i diskussionsgruppsmeddelandet:81A3043681E6824EBE672F7421C30E7E2A1952@SRVTORON TO.RAND.COM... So tell us? Mike -----Original Message----- From: Jesper Blomstrm [mailto:jeppe@partitur.se] Sent: Monday, March 19, 2001 4:51 PM To: php-general@lists.php.net Subject: SV: [PHP] PHP vs Servlet I found out how to do it. Thx anyway / J Jesper Blomström <jeppe@partitur.se> skrev i diskussionsgruppsmeddelandet:3AB6293B.688FFF3A@partitur.se... > Hi! > > I am sure you have a solution to this... > > How shall I communicate with a servlet from PHP? > I have a servlet which makes a DB-query and returns the > result. > > Thanks! > > > > / Jeppe > > > > -- > Jesper Blomström > jeppe@partitur.se > Arbete: 08-566 280 08 > Hem: 08-669 23 10 > Mobil: 070-30 24 911 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#45478) next »