Page 592 - Beginning PHP 5.3
P. 592

Part III: Using PHP in Practice
                    }

                    ?>
                      </body>
                    </html>

                Run the script by visiting its URL in your Web browser. In the form that appears, enter the URL of a
                known Web site and click Find Links. After a short time you should see a list of all the URLs linked to
                from that page, as shown in Figure 18-1.





































                    Figure 18-1


                How It Works
                After displaying the XHTML page header, the script calls displayForm() to display a simple form
                requesting a URL to scan. If the form has already been submitted, it is processed by calling
                processForm():
                    displayForm();

                    if ( isset( $_POST[“submitted”] ) ) {
                      processForm();
                    }





              554





                                                                                                      9/21/09   6:17:56 PM
          c18.indd   554
          c18.indd   554                                                                              9/21/09   6:17:56 PM
   587   588   589   590   591   592   593   594   595   596   597