• About Sarwar
  • Portfolio
  • আমার বাংলা

sarwar's weblogs

~ story of web applications…..

sarwar's weblogs

Monthly Archives: March 2011

Extract Zip File Using PHP

24 Thursday Mar 2011

Posted by Sarwar in PHP

≈ 2 Comments

Tags

PHP, unzip, zip, ziparchive


Sometime we need to extract a file on the server, say you don’t have access to shell and you want to extract a zip file, just put this to a php file and upload and run

     $zipObj = new ZipArchive;
     $file = $zipObj->open(’zip_file_name.zip’);
     if ($file == TRUE) {
         $zipObj->extractTo('extract_directory/');
         $zipObj->close();
         echo 'Unzip Successfully';
     } else {
         echo 'Failed to unzip';
     }

Its very simple and available idea everywhere, i jut wrote for note
Done!!! 🙂

Advertisement

Share this:

  • Tweet
  • Email

Like this:

Like Loading...

SQL Error: 1030: Got error 139 from storage engine -solution

22 Tuesday Mar 2011

Posted by Sarwar in MySQL

≈ 4 Comments

Tags

Engine, MySQL Error, Storage


I developed a project and sometime later client faced that they are not able to saved data, so I checked database table, the table have more than 10 columns text type.

I googling and find out that table engine is InnoDB and InnoDB limitation row length of 8000 bytes, thats the problem,

I changed it to MyISAM and test, it working properly

 ALTER TABLE `table_name` ENGINE = MYISAM 

Its work with me now.

Share this:

  • Tweet
  • Email

Like this:

Like Loading...

twitter api fetch twitter user feeds, manage and display on your website using php

18 Friday Mar 2011

Posted by Sarwar in API, PHP, Twitter

≈ 2 Comments

Tags

Fetch Data, Format Data, PHP, Retwittet, Twitter API


I know this one is old thing and helps is available but sometime we need to fetch twitter feeds Retwittet, Mentions, to our websites. Now i used json request and format the texts and print.

 function twi_fid(){
  
  ## NUMBER OF TWITTET 
  $size = 5;
  
  ## FETCH THE TWITTER TWITTET
  $twittet = file_get_contents("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=bdsarwar&count=$size&include_rts=t&include_entities=t");
  
  
  $data = json_decode($twittet);
  $o_text = "";
  foreach($data as $t)
  {
      $o_text = $t->text;
      
      ## MAKING URLS ENABLE TO TEXT
      $entities = $t->entities;
      
      $i = 0;
      foreach($entities->urls as $url)
      {
          $indicate = $url->indices;

          $replace[$i] = $url->url;
          $string[$i] = "<a target='_blank' href='".$url->url."'>".$url->url."</a>";

          
          $i++;
      }
      
      ## MAKING MENTIONS 
      foreach($entities->user_mentions as $mention)
      {
          $indicate = $mention->indices;
          
          $string[$i] = "<a target='_blank' href='http://www.twitter.com/".$mention->screen_name."'>".$mention->screen_name."</a>";
          $replace[$i] = $mention->screen_name;
          
          $i++;
      }
     
      for($i = 0; $i < count($string); $i++)
      {
          
          $pattarn = $replace[$i];
          $o_text = str_replace($pattarn, $string[$i], $o_text);
     
      }
      
    echo $o_text;
    echo "<br />";
    echo date("d/m/Y, H:m a", strtotime($t->created_at));
    echo "<br/> ___ <br />";

      
  }
  }
  twi_fid();

For detail parameter please visit: http://apiwiki.twitter.com/w/page/22554679/Twitter-API-Documentation
and for user timeline json visit http://dev.twitter.com/doc/get/statuses/user_timeline

Done !!

Share this:

  • Tweet
  • Email

Like this:

Like Loading...

Author

  • Sarwar

Categories

  • .htaccess
  • Apache
  • API
  • CSS
  • Debug
  • Framework
    • CakePHP
  • HTML
  • JavaScript
    • Ajax
    • ckeditor
    • jquery
    • jQuery UI
    • tinymce
  • Joomla
    • Virtumart
  • Linux
  • MySQL
  • PHP
  • SVN
  • Twitter
  • WHM/cPanel
View Sarwar Hossain's profile on LinkedIn
Follow bdsarwar on Twitter

Tweets

  • RT @ESPNUK: If Erling Haaland wanted to match Cristiano Ronaldo's 700 league goals, he'd have to score 40 goals a season until the year 203…    1 month ago
  • RT @Cristiano: Great team effort and a good victory. We stand together. Let’s go, United! 💪🏽 https://t.co/GnjAR3oM3s    3 months ago
  • RT @Cristiano: Hard work always pays off 🙏🏽💪🏽 https://t.co/kMqIpB2nfV    5 months ago
  • RT @realDonaldTrump: Just finished a very good conversation with President Xi of China. Discussed in great detail the CoronaVirus that is r…    2 years ago
  • “Running a small business without a plan is a lot like driving without directions.” — @GoldmanSachs via @appexchange    6 years ago
  • RT @TechCrunch: 5K people turn up to catch Pokémon in Chicago tcrn.ch/2aaLRys https://t.co/VVQSd7nmN4    6 years ago

Flickr Photos

From Helipad ViewAbove the CloudHillNear to SkySunset Moment#sunset #beach #ocean #coxsbazar#jamroll #food #deliciousfood #homemade  #homemadefood#seaside #ocean #oceanview #travelphotography #coxsbazar #bayofbengal #travel #longestbeach#beach #lifeguard #seaside #holiday #tour #longestbeach #travel #travelphotography #coxsbazar #bayofbengal#resort #mountains
More Photos

Archives

  • February 2012 (1)
  • January 2012 (2)
  • August 2011 (1)
  • July 2011 (1)
  • June 2011 (2)
  • May 2011 (2)
  • April 2011 (1)
  • March 2011 (3)
  • December 2010 (3)
  • November 2010 (1)
  • October 2010 (4)
  • September 2010 (1)
  • June 2010 (1)
  • May 2010 (2)
  • April 2010 (1)
  • March 2010 (1)
  • January 2010 (2)
  • July 2009 (1)
  • January 2009 (1)
  • August 2008 (1)

Recent Comments

  • Kush on how to cakephp in a sub-directory, access it from root using .htaccess
  • Mr Griever on Access session data in a model -cakephp
  • apnarahimyarkhan on cakephp- CONCAT in query, Virtual Fields and make a drop down
  • Toko Kunci Pintu Murah on set & reset form text value onfocus, onblur, onclick using javascript
  • nevitaputri1.doodlekit on cakephp- CONCAT in query, Virtual Fields and make a drop down
  • RSS - Posts
  • RSS - Comments

Meta

  • Register
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.com

Create a free website or blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • sarwar's weblogs
    • Join 328 other followers
    • Already have a WordPress.com account? Log in now.
    • sarwar's weblogs
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
%d bloggers like this: