hamedalfahad / php-serial

Automatically exported from code.google.com/p/php-serial
0 stars 0 forks source link

Windows Read Serial Support #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have got windows to read from my serial port using the following code in
place of the 'not implemented' comment:

------
        elseif ($this->_os === "windows")
        {
            $content = "";

            if ($count > 0)
            {
                $content = fread($this->_dHandle, $count);
            }

            return $content;
        }
-----

System: Vista 32bit with a Prolific USB to serial adapter cable.

I hope that it is of some help.

Cheers,

David

Original issue reported on code.google.com by david.ro...@gmail.com on 30 Dec 2009 at 8:47

GoogleCodeExporter commented 9 years ago
does this code really work ?

please confirm sir...

if yes i would take up my final year project related to web controlled arduino 
please reply sir...

Original comment by THEREDR...@gmail.com on 6 Jan 2011 at 5:04

GoogleCodeExporter commented 9 years ago
Why would I make a post saying it works if it didn't? give it a test for your 
hardware it will take all of 20 mins.

As an added bonus I have attached my working version of the class.

Have Fun!

Original comment by david.ro...@gmail.com on 9 Jan 2011 at 7:35

Attachments:

GoogleCodeExporter commented 9 years ago
It looks very good!I send the message to MCU.It's all right!

Original comment by gongqing...@gmail.com on 27 May 2011 at 9:16

GoogleCodeExporter commented 9 years ago
Yes, it is working for me... :-)

Original comment by honzapr...@gmail.com on 31 May 2011 at 9:08

GoogleCodeExporter commented 9 years ago
What version of pf PHP is this working on? Will it work running Apache, PHP5.2 
on Windows 7 64Bit?  It works fine to write to the com port but I am still 
unable to read the comp port. 

Original comment by mustangc...@gmail.com on 18 Nov 2011 at 7:44

GoogleCodeExporter commented 9 years ago
PHP Version 5.3.1 (XAMPP package)

Be worth checking php doco for issues using 'fread' and 64-bit, since the 
change uses it to read the data.

Original comment by david.ro...@gmail.com on 20 Nov 2011 at 7:33

GoogleCodeExporter commented 9 years ago
so it mean that if i use XAMPP package then i can read the data from COM port 
in my windows? please give me some advices, and thank in advance.

Original comment by sokmeng....@gmail.com on 15 Mar 2012 at 3:21

GoogleCodeExporter commented 9 years ago
It means if your php/apache is running with sufficient privelege to access your 
windows com ports then you should be able to read from it.

Original comment by david.ro...@gmail.com on 16 Mar 2012 at 2:13

GoogleCodeExporter commented 9 years ago
For me, write does work, read doesn't unfortunately. Even with the suggested 
change in code..

Original comment by vandenbe...@gmail.com on 1 Apr 2012 at 8:56

GoogleCodeExporter commented 9 years ago
hai all,, I need Help..
I was try php_serial.class.php
code
$serial->sendMessage('Hallo');
why I cannot get reply with code
$result=$serial->readPort();
print $result;

regard newbie

Original comment by cilok.e...@gmail.com on 19 Jun 2012 at 6:57

GoogleCodeExporter commented 9 years ago
cilok.e...@gmail.com
for windows it is imposible to receive data from serial communication
that features only work in linux

Original comment by bayu.wib...@gmail.com on 8 Feb 2013 at 12:31

GoogleCodeExporter commented 9 years ago
U ARE Impossible @ bayu.wib...@gmail.com

Original comment by Jaspreet...@gmail.com on 19 Nov 2013 at 11:00

GoogleCodeExporter commented 9 years ago
i made it work in windows also, Try it Mr Impossible. ;-)

Original comment by Jaspreet...@gmail.com on 19 Nov 2013 at 11:02

GoogleCodeExporter commented 9 years ago
@davi.ro...@gmail.com
I don't think it is reading anything. I looked (and tested) your file. function 
readPort has $count=0. When it moves down to if statement for windows, it will 
skip if ($count>0), hence, $content is always blank.

And if you pass a variable other than 0 for count, your version does no better 
than the original buggy php_serial.class.php

Kindly correct me if i am wrong. I can't get the damn thing to work (reading 
port).

@Jaspreet
If you were able to read from the port, could you please give me your version 
of php_serial.class.php along with any test code your wrote. 

Any help appreciated guys

Original comment by srivasta...@gmail.com on 16 Dec 2013 at 5:34

GoogleCodeExporter commented 9 years ago
Same issue for me, unable to read with XamppLite 1.7.3 PHP 5.3.1 and Apache 
2.2.14

thanks for your help

Original comment by pyzim...@gmail.com on 17 Dec 2013 at 10:46

GoogleCodeExporter commented 9 years ago
how to make it work?? I try the file also didn't work

Original comment by leeyensi...@gmail.com on 25 Mar 2014 at 7:39

GoogleCodeExporter commented 9 years ago
can anyone give the html/php code to show the result on browser? im using 
windows

Original comment by duckin...@gmail.com on 11 Apr 2015 at 2:58

GoogleCodeExporter commented 9 years ago
weare trying it right now and it worked

Original comment by tapish...@gmail.com on 16 Apr 2015 at 3:11

GoogleCodeExporter commented 9 years ago
Hi,

I am trying something similar :  Arduino is printing some values in the COM15, 
i am trying to retrieve it and display on the web page. 
Using Xampp on windows 8 32bit machine.

I tried with your php_serial.class.php file too. All i get is a blank page. 
What could be the error ?

Original comment by karthiku...@gmail.com on 20 Apr 2015 at 6:57