Tag Archives: PHP

github-logo-transparent

PHP GitHub followers count script (v3.0 API)

Php GitHub Followers Count

The following PHP GitHub Followers Count script is using the v3.0 GitHub API.

 

Overview

 I’ll explain how to get your github  followers count using PHP.

 

Get Followers Count



<?php
function curl_get_contents($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$github_data = json_decode(curl_get_contents('https://api.github.com/users/your-user-name'), true);
$github_followers_count = $github_data['followers'];
echo $github_followers_count;
?>

 

 

More information

This article was based on the work of Jimbo and Meenakshi Sundaram R

Development Specialist, Artist and Activist
Personal Website
twitter-logo

PHP Twitter Followers Count script (v1.1 API)

Php Twitter Followers Count

The following PHP Twitter Followers Count script is using the new v1.1 Twitter API.

 

Overview

Recently, Twitter have changed their API and v1.0 is obselete. The new API requires OAuth. I’ll explain how to get your twitter followers count using PHP.

 

Create Application

First, you’ll need to get yourself a twitter dev account, if you haven’t done so yet.

Go here and register your app free.

 

TwitterAPIExchange

Download the TwitterAPIExchange library files created by J7mbo into your application.

you can

git clone https://github.com/J7mbo/twitter-api-php
.

I recommend the git method as you can git pull later to recieve updated.

 

Get Followers Count

Insert your OATH and Consumer Access-Token & Access-Token secret the the following code. Also, change the $getfield screen name to yours.

Now combine everything to make it work


require_once('TwitterAPIExchange.php');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => "YOUR_OAUTH_ACCESS_TOKEN",
'oauth_access_token_secret' => "YOUR_OAUTH_ACCESS_TOKEN_SECRET",
'consumer_key' => "YOUR_CONSUMER_KEY",
'consumer_secret' => "YOUR_CONSUMER_SECRET"
);

$ta_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=replace_me;
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$follow_count=$twitter->setGetfield($getfield)
->buildOauth($ta_url, $requestMethod)
->performRequest();
$data = json_decode($follow_count, true);
$followers_count=$data[0]['user']['followers_count'];
echo $followers_count;

 

Notes

I’ve placed the entire twitter-api-php folder inside my project. you can extract the files also, but make sure to require_once() from the correct path.

require_once(‘twitter-api-php/TwitterAPIExchange.php’);

if you’ve placed it inside the folder, or

require_once(‘TwitterAPIExchange.php’); if you extracted the files to the same folder as your script.

 

More information

This article was based on the work of Jimbo and Meenakshi Sundaram R

Development Specialist, Artist and Activist
Personal Website
codelobster-logo

CodeLobster Handy Code Tools Review – Free portable IDE for PHP/HTML/CSS/JavaScript development

Overview

Excited today, I’m going to try a new IDE for Windows: CodeLobster PHP Edition 4.5.1.

With almost 30 years experience in development, from the age of Commodore & QBasic to today’s VS, Eclipse, NetBeans, Vi, etc….  I’ve used them all to create some code (even  NotePad). Sometimes, I am using more then one editor at once!

 

Continue reading

Development Specialist, Artist and Activist
Personal Website
wordpress-logo-stacked-rgb

Fix WordPress Plugin HTML5 Swiffy Insert

Google Swiffy

Swiffy is a web-based tool developed by Google that converts SWF files to HTML5.
Its main goal is to display Flash contents on devices that do not support Flash, such as iPhone, iPad, and Android Tablets.

Continue reading

phpbb

Fix phpBB Unable to allocate memory for pool

Overview

This tutorial explains how to fix phpBB Unable to allocate memory for pool warnings and errors that show up on certain web server configurations.

phpbb Unable to allocate memory for pool

Continue reading

web-tech-words-black

HTML Secrets – Web Application Architecture Design Tips

html

Whatever site or web application you’re working on, you probrably going to use HTML.

These are the tips I’ve learned over time:

Continue reading

Development Specialist, Artist and Activist
Personal Website
web-tech-words-black

The BEST Tools for your website

Introduction

In each new project, choosing the right tools is the first step to success. It can be said that most tasks could be accomplished using most tools, but with cons/pros over the others.
Should I use PHP? ASP.NET? CMS? WORDPRESS? JOOMLA? MVC? ZEND? SYMPHONY? so many names and frameworks, one usally returns to what he best knows.

Continue reading

Development Specialist, Artist and Activist
Personal Website
wordpress-logo-stacked-rgb

Must have best FREE WordPress plugins 2012

FREE WordPress plugins 2012

To summarize the year 2012 I have compiled a list of must have WordPress plugins:

Continue reading

Development Specialist, Artist and Activist
Personal Website