13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20<br />

Using Network <strong>and</strong> Protocol<br />

Functions<br />

IN THIS CHAPTER, WE LOOK AT THE NETWORK-ORIENTED functions in <strong>PHP</strong> that enable<br />

your scripts to interact with the rest of the Internet. A world of resources is available out<br />

there, <strong>and</strong> a wide variety of protocols is available for using them.<br />

Key topics covered in this chapter include<br />

n Examining available protocols<br />

n Sending <strong>and</strong> reading email<br />

n Using data from other websites<br />

n Using network lookup functions<br />

n Using FTP<br />

Examining Available Protocols<br />

Protocols are the rules of communication for a given situation. For example, you know<br />

the protocol when meeting another person:You say hello, shake h<strong>and</strong>s, communicate for<br />

a while, <strong>and</strong> then say goodbye. Different situations require different protocols. Also, people<br />

from other cultures may expect different protocols, which may make interaction difficult.<br />

Computer networking protocols are similar.<br />

Like human protocols, different computer protocols are used for different situations<br />

<strong>and</strong> applications. For instance, you use the Hypertext Transfer Protocol (HTTP) when<br />

you request <strong>and</strong> receive web pages—your computer requests a document (such as an<br />

HTML or <strong>PHP</strong> file) from a web server, <strong>and</strong> that server responds by sending the document<br />

to your computer. You probably also have used the File Transfer Protocol (FTP)<br />

for transferring files between machines on a network. Many others are available.<br />

Most protocols <strong>and</strong> other Internet st<strong>and</strong>ards are described in documents called<br />

Requests For Comments (RFCs).These protocols are defined by the Internet Engineering

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!