leungeric.com

Digg del.icio.us Technorati StumbleUpon Twitter

Get Remote Webpage Information

Code Snippets | PHP | PHP | Tutorials & Resources

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Simple code snippet to retrieve remote webpage information, including page title, page description, and keywords

<?php
$url = “http://www.leungeric.com/”;
$fp = fopen( $url, ‘r’ );
$content = “”;
while( !feof( $fp ) ) {
$buffer = trim( fgets( $fp, 4096 ) );
$content .= $buffer;
}

$start = ‘<title>’;
$end = ‘<\/title>’;

preg_match( “/$start(.*)$end/s”, $content, $match );
$title = $match[ 1 ];

$metatagarray = get_meta_tags( $url );
$keywords = $metatagarray[ "keywords" ];
$description = $metatagarray[ "description" ];

echo “<div>URL: $url</div>\n”;
echo “<div>Title: $title</div>\n”;
echo “<div>Description: $description</div>\n”;
echo “<div>Keywords: $keywords</div>\n”;
?>

Turning MySQL Data to UTF-8

MySQL | PHP | Tutorials & Resources

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Just add below line after MySQL connection is establisted:

mysql_query(”SET NAMES utf8″);

HTML Mine Mail for PHP Usage Tutorial

PHP | Tutorials & Resources

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

This is a PHP class which allows you to easily send email from your PHP scripts with attachments, HTML and embedded images. If you have a PHP project needs to deal with HTML email with attachments, you’ll definitely want to take advantage of this class.

(Read more)

1

Sponsors