Wednesday, February 4, 2009

"Bondho Janala"



"Bondho Janala"
Title Song of the album by
S H I R O N A M H I N
Album- Bondho Janala
lyric and tune: Zia

Arekbar dure jete chai, rim jhim shudurpur
Obak roud bheja topto dupur
Arekbar tomader, laal neel rong anonde
Ekla rastay ek chilte roddur
Shara bela bondho janala....
Arekbar jete chai laal neel laal shudurpur

Jodi tomader onek shobdo amar janalay
Soto soto anonder sporshe angule rekhe jay
Jodi shohosro shobder utshob theme jay
Shara bela bondho janala....

Jodi tomader laal neel golpo
Amar shorire
Kono ekla rastay obak vromone
Jodi ichcher neel rong akash chuye jay
Shara bela bondho janala....

Sunday, February 1, 2009

Curly use of cURL in php

I's interested in cURL in php since when Rashim was looking for something to get the yahoo weather feed as it is. He made it using cURL and I just loved it- amazed with versatile use of cURL.

I's looking for a way to get the all the statistics and searching facilities for expired or deleted domain names. And finally I decided to use cURL to search from some free service providers on the net although the usual approach I got is to store the names performing some scheduled search from who-is servers.
Anyway, here I'm gonna share all I've been playing with cURL :

Getting required html content from a website using cURL :
$url = "http://www.example.com/domains/detailedStatistics";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
$regex = '~(.*?)
~s';
preg_match($regex,$curl_scraped_page,$match);
//var_dump($match);
echo "Detailed domain statistics:
";
echo "
". $match[0]."
";

?>

Searching on a website using cURL and parsing the html to get desired result:

I used a html form to post input values to a searcher file. The code on the searcher file looked like :
//A Beautiful html dom parser
include('./simple_html_dom.php');
$cat = explode("?",$_SERVER['REQUEST_URI']);

$url = "http://www.example.com/Domain_Name_Search_Results.aspx?".$cat[1];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);

// find all tabele tags with id=results
$html = str_get_html($curl_scraped_page);


$thetable = $html->find('table[class=BlackLeftRight]',0);
foreach($thetable->find('img') as $img)
{
$img->outertext = "";
}
echo "".$thetable->innertext."
" ;

?>
That's it :) Happy curling then :)

Reference: