google-php-client example calls the authorization URL when user clicks a link. I want to call it when page loads without any user click. The way it is implemented in google-client example:
$client = new Google_Client();
$client->setApplicationName('Google Contacts PHP Sample');
$client->setScopes("http://www.google.com/m8/feeds/");
$auth = $client->createAuthUrl();
print "<a class=login href='$auth'>Connect Me!</a>";
I am trying to remove dependency on clicking on Connect Me
link and call url given by $client->createAuthUrl()
. I am new to Codeigniter that's why struggling on this simple task.
I check that there are following different ways to call an URL but not sure which one will work here:
- cURL
- file_get_contents
- stream_context_create
I am using php 5.3 with XAMPP