Skip to content

Instantly share code, notes, and snippets.

View 4cm's full-sized avatar

4CM Network 4cm

View GitHub Profile
@4cm
4cm / [php] datetime_IsUnixTimeStampValid
Created July 6, 2019 10:13
Validate if a Unix timestamp is valid.
/**
* Validate if a Unix timestamp is valid.
*
* @param $unixtimestamp
* @return bool
*/
function datetime_IsUnixTimeStampValid($unixtimestamp) {
//
//
///////////////////////////////////////////////////////////////////////
@4cm
4cm / curl_GetDataWithAuthorizationBearer
Created July 6, 2019 10:01
php curl method to get content of a json request, while using an Authorization Bearer httpheader option.
/**
* @param $url
* @param $token
* @return bool|string
*/
function curl_GetDataWithAuthorizationBearer($url, $token) {
//
$cookie = tmpfile();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);