RegExLib.com bills itself as the Internet's first Regular Expression Library. It has an online tool for testing regular expressions.
Fetching and saving the contents of a remote file
Submit a query to a search engine and save the results to a local file
1. Create a form that submits a query to a search engine.
2. Script should automatically save the query results to a file. Each query should be saved to separate files.
Figuring out the url of the remote file/search engine that you will submit your query to:
Following the trail of breadcrumbs
What are "breadcrumbs"? you may ask. The name comes from the Hansel and Gretel fairy tale in which the pair used breadcrumbs to create a trail leading them out of the forest; the forest in this case is your website. Breadcrumbs are a trail of navigational links, that help a user determine where they are located in a hierarchical website.
The code that this script was originally posted to the PHP mailing list by Matt Williams -> Visit Homepage
PHP Code:
1. Takes the URL like of a webpage i.e. http://www.blank.com/void/warp.html
Javascript and PHP Interaction
The difference between Javascript and PHP
Javascript is a client side language, meaning that it is processed by the browser not the server. PHP is a server side language, that is processed by the server and the result of the process is displayed by the browser. A typical page that includes both lnaguages will be processed in this order - a browser sends a request for a document to the server, the server will send the document to the PHP parser to process the PHP code, then sends the document to the browser which then processes the Javascript.
Creating a random link generator
The random generator code that this generator uses was originally posted to the PHP mailing list. View the original: Retrieve random Sql results
SQL for links table:
# Table structure for database table 'links'
#
CREATE TABLE links (
id tinyint(5) DEFAULT '0' NOT NULL auto_increment,
name char(250) NOT NULL,
url char(250) NOT NULL,
alt char(250) NOT NULL,
PRIMARY KEY (id)
);
PHP Code:
<?php
$db = mysql_connect("server", "username", "password");
mysql_select_db("database",$db) or die ("Unable to connect to database");