Contact Grabber

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

tovishalck wrote:What is the difference between GPL & LGPL? As I mentioned, we are going to put it up as Open Source under the GPL license. Will that be a problem? The 3 scripts of Yahoo, Gmail & Hotmail are already GPLed.
Imagine I'm writing an application that uses your library. If my application uses a library that's released under the GPL then I have to release my entire application under the GPL too. If my application uses a library that's released under the LGPL then I have to release that library under the terms of the LGPL, but my application can be under a different license if I want it to be. That can be a closed source commercial license, or Creative Commons, or Public Domain, or anything.

I would say the real difference is that if you release the library as GPL then other open source apps might use it but noone else will. If you release it under the LGPL then anyone writing an application that needs it's functionality might use it.

One thing to note though: if you're using libraries that are under the GPL in your library then you have no choice, you have to release your library under the GPL too.
tovishalck
Forum Newbie
Posts: 10
Joined: Wed Apr 25, 2007 2:11 pm

Post by tovishalck »

onion2k wrote:
tovishalck wrote:What is the difference between GPL & LGPL? As I mentioned, we are going to put it up as Open Source under the GPL license. Will that be a problem? The 3 scripts of Yahoo, Gmail & Hotmail are already GPLed.
Imagine I'm writing an application that uses your library. If my application uses a library that's released under the GPL then I have to release my entire application under the GPL too. If my application uses a library that's released under the LGPL then I have to release that library under the terms of the LGPL, but my application can be under a different license if I want it to be. That can be a closed source commercial license, or Creative Commons, or Public Domain, or anything.

I would say the real difference is that if you release the library as GPL then other open source apps might use it but noone else will. If you release it under the LGPL then anyone writing an application that needs it's functionality might use it.

One thing to note though: if you're using libraries that are under the GPL in your library then you have no choice, you have to release your library under the GPL too.
Thanks for the information. I think we will have to freeze with GPL. Just finishing the final documentation now.
tovishalck
Forum Newbie
Posts: 10
Joined: Wed Apr 25, 2007 2:11 pm

Post by tovishalck »

Can someone guide me on the required documentation and comments in the code? We haven't put as many comments as are seen in other open source apps. Will that be a major criteria while submitting to Sourceforge, PHPClasses, etc.?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

tovishalck
Forum Newbie
Posts: 10
Joined: Wed Apr 25, 2007 2:11 pm

Post by tovishalck »

Thanks. I have already included that in the scripts. Needed to know about the inline commenting of the code.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Is this released yet ?

Retrieving many of google's data is easy once logged in since they provide a lot of their data in XML - but its sorted by affinity.

Code: Select all

<?php
set_time_limit(100);
error_reporting(E_ALL);

$c = getGmailContacts("username@gmail.com", "password", $Err);

if (!$c === FALSE)
 echo $c;
else
 print_r($Err);
?>

<?php
function getGmailContacts($Username, $Password, &$Err)
 {
        $ch = curl_init();

        curl_setopt ($ch, CURLOPT_POST, TRUE);
        curl_setopt ($ch, CURLOPT_HEADER, FALSE);
        curl_setopt ($ch, CURLOPT_USERAGENT, "phpDN");
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt ($ch, CURLOPT_REFERER, "");
        curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt ($ch, CURLOPT_MAXREDIRS, 5);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
        curl_setopt ($ch, CURLOPT_COOKIESESSION, TRUE); # PHP5 only
        curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookie.txt");
        curl_setopt ($ch, CURLOPT_COOKIEJAR,  "cookie.txt");
        curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);

        curl_setopt ($ch, CURLOPT_URL, "https://www.google.com/accounts/LoginAuth?continue=http%3A%2F%2Fwww.google.com%2F&hl=en");

        $Data = "";
        $Data .= "continue=".urlencode("http://www.google.com/")."&";
        $Data .= "nui=13&";
        $Data .= "Email=".urlencode($Username)."&";
        $Data .= "Passwd=".urlencode($Password)."&";
        // $Data .= "PersistentCookie=Yes&";
        $Data .= "rmShown=1&";
        $Data .= "signIn=Sign+in&";

        curl_setopt ($ch, CURLOPT_POSTFIELDS, $Data);

        $contents = curl_exec($ch);
        $ErrNo = curl_errno($ch);

        if ($ErrNo != 0)
         {
                $Err[] = "cURL Error @ Login :: Error No: ".curl_errno($ch).' : '.curl_error($ch);
                return FALSE;
         }

        if ($contents == NULL)
         {
                $Err[] = "contents == NULL @ Login";
                return FALSE;
         }

        curl_setopt ($ch, CURLOPT_POST, FALSE);        
        curl_setopt ($ch, CURLOPT_URL, "http://www.google.com/notebook/contacts");

        $contents = curl_exec($ch);
        $ErrNo = curl_errno($ch);

        if ($ErrNo != 0)
         {
                $Err[] = "cURL Error @ Contacts :: Error No: ".curl_errno($ch).' : '.curl_error($ch);
                return FALSE;
         }

        if ($contents == NULL)
         {
                $Err[] = "contents == NULL @ Contacts";
                return FALSE;
         }

        return $contents;
 }
?>
This doesnt seem to work with Google Apps.
Post Reply