Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joshua Thijssen:
Decoding TLS with PHP
Dec 31, 2013 @ 16:17:19

Joshua Thijssen has posted a walk-through of some work he's done to create a TLS decoder in PHP. TLS (Transport Layer Security) is a method for encrypting data being sent back and forth between the client and server, similar to how SSL is used.

As a proof of concept I wanted to see in how far I could decode some TLS data on the client side. Obviously, this is very complex matter, and even though TLS looks deceptively simple, it isn’t. To make matters worse, PHP isn’t quite helping us making things easy neither.

His solution (code posted here) goes through a few steps to finally get to the actual data:

  • Capturing TLS data
  • Gathering all the necessary fields
  • From pre-master-secret to master-secret (decoding TLS_RSA_WITH_RC4_128_SHA)
  • Partitioning our master-secret
  • Decoding our data
  • Verifying message integrity

For each step along the way he shares the relevant code and a brief description of what's happening. If you want to see the end result and try it out for yourself, check out his repository.

tagged: decode tls transport layer security protocol data tutorial

Link: http://www.adayinthelifeof.nl/2013/12/30/decoding-tls-with-php

Mikko Koppanen:
Memcached protocol support
Nov 15, 2013 @ 17:15:38

Mikko Koppanen has posted about some updates he's making to the PECL memcached extension, more specifically around binary protocol support.

There are quite a few things still missing and only binary protocol is supported at the moment, but the code seems to work reasonably well in small-scale testing. I am not sure whether this is useful for anyone, but at least it allows things such as quick prototyping of network servers, exposing sqlite database over memcached protocol etc.

An example of code using this new functionality is included in the post showing how to create both a simple sever with attached "get" and "set" handlers and a client to connect to it and enable the binary protocol.

The code is still work in progress but it’s available in github: https://github.com/mkoppanen/php-memcached/tree/feature-server. Note that you need to compile libmemcached with –enable-libmemcachedprotocol and the PECL memcached extension with –enable-memcached-protocol.
tagged: memcached binary support protocol pecl update

Link: http://valokuva.org/memcached-protocol-support/

NetTuts.com:
HTTP: The Protocol Every Web Developer Must Know – Part 1
Apr 09, 2013 @ 15:56:28

On NetTuts.com there's a new tutorial about what they think is the one thing every web developer should understand - the HTTP protocol and how its used in web-based communications.

HTTP stands for Hypertext Transfer Protocol. It’s a stateless, application-layer protocol for communicating between distributed systems, and is the foundation of the modern web. As a web developer, we all must have a strong understanding of this protocol. Let’s review this powerful protocol through the lens of a web developer. We’ll tackle the topic in two parts. In this first entry, we’ll cover the basics and outline the various request and response headers.

They cover some of the basics of the protocol first including its statelessness, the concept of URLs and the HTTP "verbs" (like GET, POST and DELETE). They also briefly cover the HTTP response codes (ex. 200, 304) and the flow of the request and response to and from the web server. They also look at some of the basic HTTP headers and the actual low-level text formats of the requests/responses.

There's a section at the end of the post that links you to a few tools that you can use to view the HTTP messaging happening in your requests, some of which you might already have. They also briefly cover the use of HTTP in a few libraries - ExpressJS, Ruby on Rails and jQuery's Ajax handling.

tagged: http protocol series basics headers statuscode verb request response

Link: http://net.tutsplus.com/tutorials/tools-and-tips/http-the-protocol-every-web-developer-must-know-part-1/

PHPMaster.com:
REST - Can You do More than Spell It? Part 4
May 21, 2012 @ 13:44:26

PHPMaster.com has posted the latest tutorial in their series covering RESTful APIS - part four of "REST - Can you do More than Spell it?" In this latest part of the series, they focus on something very key to RESTful services, the HTTP spec (and headers).

We're getting close to the end now, and the only thing remaining is to discuss a little more about the protocol you'll most likely use in any RESTful application that you write. Because HTTP is so often used with REST, that's the protocol I'd like to focus on.

He goes through the structure of a typical (raw) HTTP header and talks about some of the more common headers and what actions/settings they represent. He includes examples of setting headers (with header, naturally) and a curl example showing how to set the request headers. The tutorial is finished off with a brief mention of custom HTTP headers and the the good and bad that comes with them.

tagged: rest api tutorial series http spec protocol status header

Link:

PHPBuilder.com:
Transfer Data via Multiple Protocols with Libcurl
Sep 19, 2011 @ 17:03:23

On PHPBuilder.com today there's a new tutorial showing how to use libcurl to communicate with multiple protocols like FTP, HTTP, HTTPS, SMTP and STMPS. The libcurl library that can be compiled in or installed as a shared module in your PHP install to provide enhanced networking abilities.

As I wrote in my PHP multithreading with cURL article, the libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. PHP supports the libcurl library which allows you to connect and communicate to many different types of servers with many different types of protocols.

The tutorial focuses on two different types of connections (well, four really) - FTP/FTPS and HTTP/HTTPS - and how to transfer data across each. Some code is included to create a (procedural) tool to send an uploaded file to a remote site.

tagged: tutorial libcurl ftp ftps http https networking multiple protocol

Link:

Bradley Holt's Blog:
Exploring RabbitMQ and PHP
Jul 21, 2011 @ 14:13:17

In a new post Bradley Holt looks at some of his exploration into the combination of RabbitMQ and PHP as a possible platform for messaging between process (or applications).

I’m exploring the possibility of using RabbitMQ for an upcoming project. RabbitMQ is a free/open source message broker platform. It uses the open Advanced Message Queuing Protocol (AMQP) standard and is written in Erlang using the Open Telecom Platform (OTP). It promises a high level of availability, throughput, scalability, and portability. Since it is built using open standards, it is interoperable with other messaging systems and can be accessed from any platform.

He goes through the full process - installing RabbitMQ via MacPorts, grabbing the latest copy of the librabbitmq library and installing it and finally installing the AMQP extension for PHP so they can communicate. He includes some simple code that connects to the queue and sends a "hello world" message out to the connection bound to "routeA".

tagged: rabbitmq messaging protocol platform tutorial extension librabbitmq pecl

Link:

PHPBuilder.com:
Implementing Internet Protocols with PHP
Jan 13, 2011 @ 14:20:24

On PHPBuilder.com today there's a new tutorial from Leidago Noabeb that looks at implementing internet protocols - in this case FTP.

PHP has many functions that help us to implement Internet and/or networking protocols. In this article we will look at how to implement some of those protocols using PHP.

His examples uses PHP's FTP methods to create a simple frontend to a remote FTP server. Included is the code to get the basics of it working - listing remote files and displaying them out in a styled list.

tagged: tutorial internet protocol ftp

Link:

PEAR Blog:
Fixing "unsupported protocol"
Aug 28, 2009 @ 12:55:49

If you've had issues with an "unsupported protocol" message when working with the PEAR installation on your PHP instance, you should check out this quick post from the PEAR blog with a tip on how to fix it.

When trying to install something, you will get the error: pear.php.net is using a unsupported protocal – This should never happen. install failed. This problem comes from corrupted channel files. Go into your PEAR php directory and backup .channels directory.

If you go into your PEAR installation and move the .channels directory out of the way then run an "update-channels" the issue should be corrected. Unfortunately, this also means you loose all channels you'd subscribed to, but does save you from having to reinstall PEAR completely.

tagged: pear unsupported protocol error

Link:

DevShed:
Sending Email with PHP Networking
Sep 16, 2008 @ 16:21:23

DevShed has the second of a two part tutorial posted today on sending emails with the included mail() function.

In this article we will look at the protocol that is involved in sending email messages. We will also examine the thorny issue of how to send an attachment with an email message. This article is the second of two parts.

They include examples of sending simple messages and more complex ones with things like attachments and custom headers. They also tack on a look at the PEAR::Mail package to the end showing how it can make sending some things a little less painful.

tagged: email networking tutorial protocol simple complex attachment header

Link:

PHPFreaks.com:
Sessions and cookies: Adding state to a stateless protocol
Jun 05, 2008 @ 17:05:11

On the PHPFreaks website, there's a new tutorial talking about sessions and cookies in PHP:

HTTP is a stateless protocol. This means that each request is handled independently of all the other requests and it means that a server or a script cannot remember if a user has been there before. However, knowing if a user has been there before is often required and therefore something known as cookies and sessions have been implemented in order to cope with that problem.

The tutorial is pretty introductory, so if you're not new to the PHP world, you won't learn much. New developers, though, will learn how to set cookies, use sessions and learn a bit about the security of both.

tagged: session tutorial introduction cookie state stateless protocol http

Link:


Trending Topics: