xymalf Posted July 29, 2012 Share Posted July 29, 2012 set_time_limit(0); I am trying to run a php program using command prompt but i am getting a 75 second time out error despite having the above line in my code. Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/ Share on other sites More sharing options...
Christian F. Posted July 29, 2012 Share Posted July 29, 2012 Running this on a shared host? If so, then it's highly likely that they've disabled that function. Bigger question is, in that case: What are you doing that requires a 75+ seconds of runtime on a web server? Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365295 Share on other sites More sharing options...
xymalf Posted July 30, 2012 Author Share Posted July 30, 2012 i am running a php program that gets the access token from flickr - trouble is you have to type in a long url the php script gives you when your run it. the php is running on my pc. Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365425 Share on other sites More sharing options...
Christian F. Posted July 31, 2012 Share Posted July 31, 2012 Can you post the code for this script? As far as I can see, nothing of what this script is meant to do should take so long to run. Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365740 Share on other sites More sharing options...
xymalf Posted July 31, 2012 Author Share Posted July 31, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365780 Share on other sites More sharing options...
Christian F. Posted July 31, 2012 Share Posted July 31, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365799 Share on other sites More sharing options...
xymalf Posted July 31, 2012 Author Share Posted July 31, 2012 What code do i need to add for any flickr user? Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365810 Share on other sites More sharing options...
Christian F. Posted July 31, 2012 Share Posted July 31, 2012 A form that asks for the login details, or whatever Twitter may require you to use in order to authenticate your app to interact with other user's accounts. Quote Link to comment https://forums.phpfreaks.com/topic/266420-75-second-timeout-error/#findComment-1365816 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.