home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomePHP CookbookSearch this book

Chapter 17. Internet Services

17.1. Introduction

Before there was HTTP, there was FTP, NNTP, IMAP, POP3, and a whole alphabet soup of other protocols. Many people quickly embraced web browsers because the browser provided an integrated program that let them check their email, read newsgroups, transfer files, and view documents without worrying about the details surrounding the underlying means of communication. PHP provides functions, both natively and through PEAR, to use these other protocols. With them, you can use PHP to create web frontend applications that perform all sorts of network-enabled tasks, such as looking up domain names or sending web-based email. While PHP simplifies these jobs, it is important to understand the strengths and limitations of each protocol.

Section 17.2 to Section 17.4 cover the most popular feature of all: email. Section 17.2 shows how to send basic email messages. Section 17.3 describes MIME-encoded email, which enables you to send plain-text and HTML-formatted messages. The IMAP and POP3 protocols, which are used to read mailboxes, are discussed in Section 17.4.

The next two recipes discuss how to read newsgroups with NNTP. Newsgroups are similar to mailing lists, but instead of every person on the list receiving an email message, people can access a news server and view just the messages they're interested in. Newsgroups also allow threaded discussions, so its easy to trace a conversation through the archives. Section 17.5 discusses posting messages, while Section 17.6 covers retrieving messages.

Section 17.7 covers how to exchange files using FTP. FTP, or file transfer protocol, is a method for sending and receiving files across the Internet. FTP servers can require users to log in with a password or allow anonymous usage.

Searching LDAP servers is the topic of Section 17.8, while Section 17.9 discusses how to authenticate users against an LDAP server. LDAP servers are used as address books and as a centralized store for user information. They're optimized for information retrieval and can be configured to replicate their data to ensure high reliability and quick response times.

The chapter concludes with recipes on networking. Section 17.10 covers DNS lookups, both from domain name to IP and vice versa. The final recipe tells how to check if a host is up and accessible with PEAR's Ping module.

Other parts of the book deal with some network protocols as well. HTTP is covered in detail in Chapter 11. Those recipes discuss how to fetch URLs in a variety of different ways. Protocols that combine HTTP and XML are covered in Chapter 12. In that chapter, along with covering DOM and XSLT, we discuss the emerging area of web services, using the XML-RPC and SOAP protocols.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.