This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class twitter { | |
public $twitter_base = 'http://twitter.com/statuses'; | |
public $twitter_username = '<-username->'; //Your username here | |
function latest(){ | |
$url = "$this->twitter_base/user_timeline/$this->twitter_username.xml?count=5"; | |
$content = file_get_contents($url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = "file.txt"; | |
$handle = fopen($filename, "r"); | |
$data = fread($handle, filesize($filename)); | |
$data_array = explode(",", $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class log { | |
public $filename; | |
public $timestamp; | |
public $ip; | |
public $u_agent; | |
public $u_refer; | |
public $ub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$filename = 'log.txt'; | |
$timestamp = date('l d F Y H:i:s'); | |
$u_agent = $_SERVER['HTTP_USER_AGENT']; | |
$ub = ''; | |
if(preg_match('/MSIE/i',$u_agent)) | |
{ | |
$ub = "Internet Explorer"; | |
} | |
elseif(preg_match('/Firefox/i',$u_agent)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//returns true, if domain is availible, false if not | |
function isDomainAvailible($domain) | |
{ | |
//check, if a valid url is provided | |
if(!filter_var($domain, FILTER_VALIDATE_URL)) | |
{ | |
return false; | |
} | |
//initialize curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function autoUpdatingCopyright($startYear){ | |
// given start year (e.g. 2004) | |
$startYear = intval($startYear); | |
// current year (e.g. 2007) | |
$year = intval(date('Y')); | |
// is the current year greater than the | |
// given start year? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_followers($twitter_id){ | |
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id); | |
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) { | |
$tw['count'] = $match[1]; | |
} | |
return $tw['count']; | |
} | |
$nb = get_followers('phpsnippets'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset=utf-8> | |
<title></title> | |
<link rel="stylesheet" href="css/style.css"> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |