I am using php codeigniter and i am trying to import my contacts from my gmail and yahoomail exactly like twitter... I dont know how to get started? Any suggestion?
One suggestion is to investigate OAuth.
What OAuth support allows is trusted 3rd party access to secure data. Previously, Twitter required your gmail user account details and logged in as you, and using the gdata protocol, queried your contacts, pulling in the data. You hoped that twitter used your creds securely, and didn't bother storing them.
With OAuth does, is allows Twitter to make a request to Gmail on your behalf. Instead of giving Twitter your Gmail account creds, Gmail asks you if it's okay to share certain data with Twitter. Should you accept this request, the data is shared, securely, while not requiring you to divulge your gmail creds to twitter or any other party.
With regards to actually getting data, take a look at Google's Contact API. Those are the calls your app might typically use to pull in contacts.
Contact Grabber from PHP classes site would be a good start...
For a commercial solution, you could give RecogniContact (-> Address-Parser.com) a try.
You could also check out CloudSponge.com. Uses OAuth to access Yahoo, Gmail, Windows Live contact sources, plus provides access to AOL, Plaxo, Outlook, Apple Address Book. One API to access them all.