Arduino + PHP

Hello everyone, I would like to know if there is some place where I can get some help on how to use arduino with php.
thanks :slight_smile:

Arduino with PHP?

This could mean a number of things:

  1. Running PHP on an Arduino, like you would on a webserver.

  2. Comiling PHP so it runs on the Arduino in a similar way to C/C++ in the IDE.

  3. Running some code on the Arduino which calls a php script on a web server.

Can you elaborate on what you are trying to do?

Regards,

Mike

Well, sorry, I will try to be more clear this time.

I'm trying to learn how to use arduino to communicate with software. I know some C and PHP. I would like to be able to build a email checker, that would, for example, use PHP to get the information from the EMAIL, and if there is a new email, get a program in C that would send some serial information to arduino to turn a led on. I found something like that on the web, but using python, and I couldn't get how it works. If anyone could give me some advices, it would be nice. :slight_smile:

Another thing would be to send some information from arduino to a program in C, for example, the number of an variable of somethings.

Thanks :slight_smile:

OK - I understand now.

This is most easily done using serial ports.

The arduino communicate to the PC using the serial port. You need an application running on the PC which can read and write to the serial port. This app can be written in C, but maybe easier in Visual Basic, Delphi or Processing.

That application will be able to poll an email server directly or it can call a PHP script running on a server somewhere.

HTH,

Mike

Yeah, I know C can be quite complicate to communicate with serial. Do you know where I can get some information on how to communicate arduino with VB or Delphi? Or maybe even with processing (can I build some executable program for example *.exe on windows, that would communicate with arduino)?

Thanks mate

I have no experience with Processing, but with VB and Delphi there are several libraries "out there" that will do serial comms.

For Delphi, I know more Delphi than VB, this one look scompetent:

http://www.domis.de/cms/index.php?module=ContentExpress&func=display&ceid=7

Regards,

MIke

Hi !
Socket (network) communication is pretty easy in PHP. You might need to be root, or something, though. ;D
See PHP: fsockopen - Manual

a

It's not well known, but "php_serial.class.php" is what your wanting.

I've got it, tried it, tested it, it works flawlessly. No need for sockets or intermediary's like processing, or even C for that matter, except the ++ you'll be coding the Arduino with.

A Lamp stack is all you need, connect you arduino to the computer via USB, then your in business :slight_smile: