In this article, Mitchell shows us how to implement our custom SARP protocol that we created yesterday. He uses PHP and its various socket functions to send SARP commands to our SARP server to both retrieve articles and add new articles to the servers Access database.
Building A Document Request Protocol Part 2/2 (Page 1 of 6 )
In part one of this article I showed you how to create a Visual Basic application that uses Winsock to accept connection requests from a client, work with a custom protocol (which we called SARP – Simple Article Request Protocol), and relay messages back to the client.
In this, the final article in the series, we’re going to look at how we can invoke SARP from a PHP script, using PHP's range of socket functions. We will first look at calling all of the commands that compose our custom SARP protocol, and then we will create a script that will retrieve content from the SARP server based on a specific set of criteria. We will also add the ability to add new content to the SARP servers Access database remotely.
To test our SARP server, you should have either Apache/IIS installed on a Linux, Unix, or Windows NT/2000/XP machine. In this article I will assume that you have the app we created in part one of this series installed and running on your local machine. I will also assume that you will be saving and running the PHP scripts on your local machine.