introduce getCurlHandle() to deduplicate

This commit is contained in:
2019-01-13 16:34:31 +01:00
parent a6ad3e4e51
commit 661b01e1e6
2 changed files with 16 additions and 17 deletions

View File

@@ -30,4 +30,13 @@ function stripLocalpart($mxid) {
return $localpart;
}
function getCurlHandle($url) {
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($handle, CURLOPT_TIMEOUT, 60);
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
return $handle;
}
?>