Archive for April, 2008
April 13, 2008 by Alex Polski | 1 Comment »
Curl library for CodeIgniter
So, let’s continue to develop Mass PageRank Checker tool. I will use CodeIgniter (CI) PHP framework for it. It’s really simple and very powerful thing. But first I need Curl library for CI to make easier working with HTTP queries.
In brief, the library must do the following things:
- Send HTTP GET/POST requests and receive HTTP responses.
- Get information about queries like HTTP error code, total time for operation, number of sent/received bytes for operation, etc.
- Handle the errors.
I just wrote this library, you can download it here.
To use it just copy Curl.php to CI’s system/application/libraries folder, curl_lang.php to CI’s system/application/language/english folder and load it from your controllers:
$this->load->library('curl');
For example let’s simulate the search in Google:
$keyword = 'travel';
$this->load->library('curl');
$this->curl->open();
$content = $this->curl->http_get("http://www.google.com/search?q=$keyword");
$this->curl->close();
echo $content;
This is very simple example. At this moment the library has not powerful features. Here the list of what you can do and how you can do using Curl library:
- Set additional options like User-Agent (MSIE 7.0 by default), timeout for operations in seconds (30 by default).
$this->curl->open(array('user_agent' => 'CURL library', 'timeout' => 60));
- Send HTTP GET query and get the content. Setting $headers_only = TRUE will cause you receive HTTP headers only. You can specify additional HTTP headers in $headers variable.
function http_get($url, $headers = array(), $headers_only = FALSE)
- Send HTTP POST query and get the content. POST parameters must be specified in $fields variable like ‘a=1&b=2&str=test%20example’
function http_post($url, $fields, $headers = array(), $headers_only = FALSE)
- There are a few functions for getting different information about query
function get_http_code()
function get_total_time()
function get_bytes_uploaded()
function get_bytes_downloaded()
function get_speed_upload()
function get_speed_download()
In the future I’m planning to add the following features to library: referer and autoreferer support, cookies, proxies, authorization, follow location feature, caching, file uploading, additional headers and may be some more.
April 5, 2008 by Alex Polski | No Comments »
New blog’s design and Blueprint CSS framework
Just finished new design for my blog. It’s fully based on Blueprint CSS framework. After I used it for Mass PageRank Checker tool’s design layout, I decided to use it for the blog’s design too and may be for all my tools and sites. It’s really cool thing.
I will not write a new tutorial about Blueprint in this post but I will give you some useful links which will help you to learn it.
- Official Blueprint tutorial
- Blueprint Google Group
- BlueprintCSS 101 - Nice article about Blueprint features
- Hands on with Blueprint, a CSS Framework - Great blueprint tutorial with code examples
- First Impressions of the Blueprint CSS Framework
- Blueprint Cheat Sheet (PDF)
These are enough to learn how to create really nice web-pages using Blueprint.














