Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 7, 20187 yr 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" ); }
March 8, 20187 yr Author yes, $query->request(10)->get() you put the timeout as a parameter for request() Is that ms or seconds?
March 8, 20187 yr 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()
Archived
This topic is now archived and is closed to further replies.