WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP based HTML rabbing Tools
Categories : PHP, HTML and PHP, Tag Extractors, Regexps, Beginner Guides
Yeni Setiawan
Date : Jul 18th 2008
Grade : 2 of 5 (graded 3 times)
Viewed : 4755
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Yeni Setiawan
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

This is two simple functions that I always use for content grabbing from another website. Easy to use, with sample.

Here are the two main functions:
<?php
// get content of URL into string
function getContentOfURL($url){
   
$file = fopen($url, "r");
    if(
$file){
        while (!
feof ($file)) { 
           
$line .= fread ($file, 1024*50); 
        }
        return
$line;
    }
    return
false;
}

// get value of text inbetween tags
function getContentByTag($tag1,$tag2,$string) { 
    if (
eregi("$tag1(.*)$tag2", $string, $out)) { 
       
$outdata = $out[1];
    } 
    return
$outdata
}
?>


Here are the examples to get value of <title></title> tags from Google.com:
<?php
$string
= getContentOfURL('http://google.com');
$title = getContentByTag('<title>','</title>',$string);
echo
$title;
?>



Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
Multiple Select box, Select multiple Items from Menu.List box
Categories : PHP, HTML and PHP, Beginner Guides
Newbie Notes #1 - Making a form return to itself
Categories : PHP, Beginner Guides, HTML and PHP
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
Form Submission Using Array's
Categories : PHP, HTML and PHP, Beginner Guides, Arrays
Parse html (title :: meta)
Categories : PHP, HTML and PHP, Regexps
Parsing html tags with php. Get an array from this function
Categories : PHP, HTML and PHP, Arrays, Tag Extractors
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
How to Create a Shoutbox Using PHP & MySQL
Categories : PHP, MySQL, Web Applications, Beginner Guides, HTML and PHP
php table decoder used to convert an html table to individual tokens through regular expressions
Categories : PHP, Regexps, HTML and PHP
Validating a URL with preg_match
Categories : PHP, Regexps, Beginner Guides, Data Validation
Kewl Date Example
Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
Form input return conformance
Categories : HTML and PHP, PHP, Regexps
Parse a HTML-document for a certain tag and display its content and attributes.
Categories : HTML and PHP, PHP, Tag Extractors