<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 20:28:57 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Brian Moon's Blog: Check for a TTY or interactive terminal in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16809</guid>
      <link>http://www.phpdeveloper.org/news/16809</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Brian Moon</i> describes a need he had for detecting if the client or user calling a PHP script was <a href="http://brian.moonspot.net/tty-or-interactive-terminal-in-php">using an interactive terminal (TTY)</a> or not:
</p>
<blockquote>
Let's say I am trying to find out why some file import did not happen. Running the job that is supposed to do it may yield an error. Maybe it was a file permission issue or something. There are other people watching the alerts. What they don't know is that I am running the code and looking at these errors in real time.
</blockquote>
<p>
Since the errors were being sent to the log file, they were lost to the client/user on the other end left staring at their script wondering what went wrong. He ended up with a solution (a pretty simple one too) that uses <a href="http://www.php.net/posix_ttyname">posix_ttyname</a> and <a href="http://php.net/posix_isatty">posix_isatty</a>. He includes the little snippet of code he puts in his prepend file that checks for errors then checks for a TTY. If both are there, it turns off logging the errors to the file and sends them direct instead.
</p>]]></description>
      <pubDate>Fri, 02 Sep 2011 09:12:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Howto Send/Read SMSs using a GSM modem, AT+ commands and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16077</guid>
      <link>http://www.phpdeveloper.org/news/16077</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today showing how you can <a href="http://gonzalo123.wordpress.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/">send and read SMS messages</a> with PHP through a GSM modem. The AT+ commands they use can be sent via a serial (or serial-to-usb) interface directly from your application to a local device. He includes both code and some sample AT commands to get the ball rolling.
</p>
<blockquote>
GSM modems are similar than normal modems. They've got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That's means we can send (and read) SMSs and create scripts to perform those operations. [...] The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface). 
</blockquote>
<p>
His base SMS class provides open, close and read methods that talk with the device set in a child class (in this case "/dev/ttySO"). The sendSMS method is defined to take in the number to send to and the message. The AT command examples show how to send the SMS message, read all of the messages waiting and delete an SMS from the device. You can get the full code <a href="https://github.com/gonzalo123/gam-sms">from github</a>.
</p>]]></description>
      <pubDate>Tue, 22 Mar 2011 08:15:27 -0500</pubDate>
    </item>
  </channel>
</rss>
