how can we import the contacts(email id) from gmail,yahoo,Hotmail,rediffmail,outlook using php.
can anybody please guide me to do this?. Is there any readymade classes available for importing Contacts from gmail or other mail clients using PHP/Mysql
Not sure about the others but outlook will export to a csv file, then you can write a simple script to read this file, I suspect the others are the same as a csv file is quite standard export format
A csv file is a way of organising database material in a format thatz easily read by most other programs, or certainly more easily programmed into applications that are user written. Each element in the exported data is seperated with a comma
ie first,second,third,forth,etc,etc, you can then use functions within PHP to split this data back into whatever format you require for your application
It’s very difficult in case of outlook if possible at all, since it’s running on user computer. In case of the online email services, you could use [fphp]curl[/fphp] functions or better yet snoopy to log in and export them to csv, then read it from there.
I think rather than the classes to connect gmail/yahoo/msn, there should be some API if they provide. But i am not sure and i dont think that the APIs are available for these all. Posting values using curl or fsockopen functions of PHP may be the solution. But for the login, we must know where to post the email address and password which is the difficult task for myself.
If anyone knows i am also curious to know about this.
The harder part is to work out all the post variables, which are often calculated dynamically and are encrypted in most cases. In order to identify all these variables, a HTTP snoofer would be helpful ( My favourite being HttpWatch).
Yes, as php_demon said CURL and Snoopy are the way to go. I would still advice against Snoopy as it used to break frequently and wasn’t updated for quite a long time (though i haven’t checked over the recent state of affairs down there ). I had one hell of a time trying to get it working for complicated HTTP requests ( espcially those involving SSL).
Even with CURL, be prepared to configure a lot of options( redirections, SSL certificates, and a lot others).
So how can i know easily that where and how the login information is to be passed (with curl or snoopy)? Please i would be very grateful to you if i know from you in case of hotmail that what exactly the url to post the login information and how the info (email id and password) are to be posted.
Get a HTTP sniffer extention for your browser and you will know where exactly are the values being posted to.
You won’t know untill you start coding yourself. Have you set up curl in your machine and tried posting to sever? Optionally, you can use the classes that have already been written to do that.