Send Data From Arduion to a PHP Page

I am new to Arduino, but not new to PHP.

I am trying to create a simple connection between PHP and Arduino, so far, I have seen lots of examples of how to connect to Arduino from a PHP web page, but now, what I am trying to do is, when a button is pressed on my Arduino board, a message is sent to PHP (the message will be used to take on different actions).

So far, I have been very unsuccessful at achieving this.

I'll appreciate any help and if possible specific examples.

PS: I am able to read the port from my terminal... I just don't know how to get PHP to read it. ScreenShot Attached.

MY PHP Code

<?php

include "phpserial.php";

$serial = new phpSerial();    
$serial->deviceSet("/dev/cu.usbmodem1411");

$serial->confBaudRate(9600); //Baud rate: 9600 
$serial->confParity("none");  //Parity (this is the "N" in "8-N-1") 
$serial->confCharacterLength(8); //Character length     (this is the "8" in "8-N-1") 
$serial->confStopBits(1);  //Stop bits (this is the "1" in "8-N-1") 
$serial->confFlowControl("none");
$serial->deviceOpen(); 

var_dump($serial->readPort());
// $serial->sendMessage(chr(10)); // start transmission
// $serial->sendMessage(1);
// $serial->sendMessage("0\r"); //THIS IS WHAT I SEND
// $serial->sendMessage(chr(13)); // end transmission

$serial->deviceClose();

In my Arduino Code, I am using Serial.println("ready!"); to print to the serial port

Thank you.

Screen Shot 2018-01-25 at 16.18.24.png

Screen Shot 2018-01-25 at 16.20.28.png

Screen Shot 2018-01-25 at 16.22.41.png

No matter which language you use, you must wait after you open the serial port before sending anything to the Arduino. 250 ms should be adequate.

Opening the port, which resets the Arduino, reading what the Arduino has sent before it has time to send anything, and closing the port doesn't make a lot of sense to me.

You need to use a while loop, after opening the port, to read everything that the Arduino (eventually) sends, until it sends "Go away", or something more (or less) friendly.