grabURL
usage
There are two uses of the grabURL class.
o Grab an URL and send it to an email address
o Grab an URL and mirror it in your site
Grab an email and send it to an email address
Consider the following code:
1. <?
2. // this script will grab yahoo.com and send it in your mailbox
3. include("grabUrl.php");
4. $foo=new grabUrl();
5. $foo->createTo("joe@xyz.com");
6. $foo->createCC("bill@xyz.com");
7. $foo->createBCC("fred@xyz.com");
8. $foo->createFrom("Fred Dust","dust@xyz.com");
9. $foo->createSubject("This is a test mail! Please Ignore!");
10.$foo->getData("http://www.yahoo.com");
11.if($foo->sendMail()){
12.echo "Mail Sent!";
13.}else{
14.echo "Error Sending Mail!";
15.}
16.?>
Line 3: Includes the main class file
Line 4: Makes an instance of the class
Line 5: Sets the mail To field
Line 6: Sets the mail Cc field (optional)
Line 7: Sets the mail Bcc filed (optional)
Line 8: Sets the mail From field
Line 9: Sets the mail Subject
Line 10: Reads the data from the URL (always prefix http:// )
Line 11: Sends the mail
Grab an URL and mirror it in your site
1. <?
2. include("grabUrl.php");
3. $foo=new grabUrl();
4. $foo->getData("http://www.yahoo.com");
5. $foo->showPage();
6. ?>
Line 3: Make an object of the class
Line 4: Reads the data from the URL (always prefix http:// )
Line 5: Display the page