Twitter-инструментарий на Ruby on Rails
Виджет amoCRM: экспорт данных в Google Docs
Alternative caching Joomla module
API Яндекс Метрика и Highcharts
JavaScript SELECT. Динамические списки
Extended weather informer. Weather Underground
Снова про курс валют Центробанка, про cross-origin и джаваскрипты
jTriad contact form - контактная форма для Joomla
jExchange rates CBR, модуль Joomla 3
Joomla: интернет-магазин без VirtueMart. K2Store
jWeather by ip. Погода по ip для Joomla!
CSV Improved. Настройка импорта из csv-файла в VirtueMart
Подарок бухгалтеру, или КЛАДР для Community Builder
Joomla и SuperJob: вакансии по API
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');
echo "PHP Snippets already have ".$nb." followers!";
function get_status($twitter_id, $hyperlinks = true) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$src = curl_exec($c);
curl_close($c);
preg_match('/<text>(.*)<\/text>/', $src, $m);
$status = htmlentities($m[1]);
if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a href="%5C%22%5C%5C0%5C%22">\\0</a>', $status);
return($status);
}
echo get_status('catswhocode');
<a href="http://twitter.com?status=@catswhocode Hi Jean, how are you?">Tweet!</a>
function tweetCount($url) {
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$retweets = $element->story->url_count;
if($retweets){
return $retweets;
} else {
return 0;
}
}
echo tweetCount('http://www.catswhocode.com');
/* makes the request */
function make_request($url) {
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/* gets the match */
function get_match($regex,$content) {
preg_match($regex,$content,$matches);
return $matches[1];
}
/* persons to test */
$person1 = 'phpsnippets';
$person2 = 'catswhocode';
/* send request to twitter */
$url = 'https://api.twitter.com/1/friendships/exist';
$format = 'xml';
/* check */
$persons12 = make_request($url.'.'.$format.'?user_a='.$person1.'&user_b='.$person2);
$result = get_match('/<friends>(.*)<\/friends>/isU',$persons12);
echo $result; // returns "true" or "false"
function getTinyUrl($url) {
return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}
function bitly($url) {
$content = file_get_contents("http://api.bit.ly/v3/shorten?login=YOURLOGIN&apiKey=YOURAPIKEY&longUrl=".$url."&format=xml");
$element = new SimpleXmlElement($content);
$bitly = $element->data->url;
if($bitly){
return $bitly;
} else {
return '0';
}
}
echo bitly("http://www.catswhocode.com");
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Masterpro.ws © 2009 - 2020 Ruby and PHP Development. Web Studio