Jump to content

75 second timeout error.


xymalf

Recommended Posts

code/

 

<?php

include_once 'Phlickr/Api.php';

 

/**

* I wrote this script because it's a real pain in the ass to generate the

* authorization tokens. Hopefully this will make it a little easier.

*

* @version $Id$

* @author  Andrew Morton <drewish@katherinehouse.com>

* @license http://opensource.org/licenses/lgpl-license.php

*          GNU Lesser General Public License, Version 2.1

*/

print "This script will help you retrieve a Flickr authorization token.\n\n";

 

// Prevent PHP from enforcing a time limit on this script

set_time_limit(0);

 

// Get the user's API key and secret.

print 'API Key: ';

$api_key = trim(fgets(STDIN));

print 'API Secret: ';

$api_secret = trim(fgets(STDIN));

 

// Create an API object, then request a frob.

$api = new Phlickr_Api($api_key, $api_secret);

$frob = $api->requestFrob();

print "Got a frob: $frob\n";

 

// Find out the desired permissions.

print 'Permissions (read, write, or delete): ';

$perms = trim(fgets(STDIN));

 

// Build the authentication URL.

$url = $api->buildAuthUrl($perms, $frob);

print "\nOpen the following URL in your browser and and authorize:\n$url\n\n";

print "Press return when you're finished...\n";

fgets(STDIN);

 

// After they've granted permission, convert the frob to a token.

$token = $api->setAuthTokenFromFrob($frob);

 

// Print out the token.

print "Auth token: $token\n";

 

// Optionally, create a config file.

print 'Save these settings? (y/N): ';

$saveit = strtolower(trim(fgets(STDIN)));

if ($saveit{0} == 'y') {

    print 'Filename: ';

    $filename = trim(fgets(STDIN));

    print "Saving settings to '$filename'\n";

    $api->saveAs($filename);

    print "Use this with Phlickr_Api::createFrom() to create an object.\n";

}

 

exit(0);

?>

\code

 

Link to comment
Share on other sites

Ah... I see.

 

I recommend you look into cURL for that, so that you can automate the login process and not have to rely on STDIN. Either get the login info from a form, which runs the above code after submitting, or define them in the top of the script. Either way will work just fine, depending upon whether you need only one or many users to auth.

 

PS: You'll want to use [php][/php] tags around your code, as it makes it a whole lot easier to read. Remember to use the square brackets. ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.