Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Aetherdan Posted March 7, 2018 Posted March 7, 2018 Is there any function available in the framework to handle timeout period when querying a url? // Now fetch it and decode the JSON try { $response = $query->request()->get()->decodeJson(); } catch( \IPS\Http\Request\Exception $e ) { die( "There was a problem fetching the request" ); } catch( \RuntimeException $e ) { die( "The response was not valid JSON" ); }
CodingJungle Posted March 7, 2018 Posted March 7, 2018 yes, $query->request(10)->get() you put the timeout as a parameter for request()
Aetherdan Posted March 8, 2018 Author Posted March 8, 2018 48 minutes ago, CodingJungle said: yes, $query->request(10)->get() you put the timeout as a parameter for request() Is that ms or seconds?
Aiwa Posted March 8, 2018 Posted March 8, 2018 4 hours ago, CodingJungle said: yes, $query->request(10)->get() you put the timeout as a parameter for request() IPS has constants for default values. Giving board administrators the option, at a constant level, to adjust the IPS parameters site wide if there are server restrictions in place. 'DEFAULT_REQUEST_TIMEOUT' => 10, // In seconds - default for most external connections 'LONG_REQUEST_TIMEOUT' => 30, // In seconds - used for specific API-based calls where we expect a slightly longer response time $query->request(\IPS\LONG_REQUEST_TIMEOUT)->get()
Recommended Posts
Archived
This topic is now archived and is closed to further replies.