Snippets Collections
time xargs -I % -P 100 curl -o /dev/null "http://127.0.0.1:9200/similarity_queue/_search" < <(printf '%s\n' {1..100}) 
## You need:
## client_id, secret_id, user, password, realm , keycloak url

access_token=$(curl --silent\
 -d "client_id=client_id" \
-d "client_secret=secret_id" \
-d "username=user" \
-d "password=password" \
-d "grant_type=password" \
"https://keycloak_url/auth/realms/{{realm}}/protocol/openid-connect/token" | jq -r '.access_token')

## show token
echo $access_token
httpClient() {
    curl --silent \
    	# everything in between
         --write-out "\n%{http_code}"
}

response=`httpClient #args #args .....`

http_code=`tail -n1 <<< "$response"`
body=`sed '$ d' <<< "$response"`
curl "https://dink.ga/api/criarURL?url=SEU_URL" 
/**
 * Verifies if passed URL (remote file or any webpage / webresource) exists
 * The check is implemented via method HEAD, so no data is downloaded anyway
 *
 * @param   <string> Remote URL to verify
 * @returns <bool>   Returns true if given URL exists, false otherwise
 */
function file_exists_remote (string $url) : bool
{
    $handle = curl_init();

    curl_setopt_array($handle, [
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_NOBODY => 1,
        CURLOPT_HEADER => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_AUTOREFERER => 1
    ]);

    curl_exec($handle);

    $responseCode = (int) curl_getinfo($handle, CURLINFO_RESPONSE_CODE);

    curl_close($handle);

    return $responseCode === 200;
}
<?php
$url = "https://graph.instagram.com/me/media?access_token=IGQVJWVGM5azZApYkEwTENxQ19kbWdmS1dfeWxJcUk2VzJobF92LWE5NTdsNlV0dGFoNGw2bkRMZATh2SnFzcGVOeDJXNVNzcUoyS3pOY2taZA3BfX25sUHA3VXVHUlBTNFVGVHp1aEktOUxXbDlpV3cxeAZDZD&fields=media_url,media_type,caption,permalink";
// create curl resource
$ch = curl_init();

// set url
curl_setopt($ch, CURLOPT_URL, $url);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// $output contains the output string
$instagramData = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch); 

$instagramData = json_decode($instagramData, true); // true = to array έστω
$instagramData = $instagramData['data'];

$tpl = 'instagramFeedTPL';
$out = '';

foreach ($instagramData as $data)
{
    if ($data['media_type'] == 'VIDEO')
    {
        $data['isVideo'] = 1;
    }
    
    $out .= $modx->getChunk($tpl, $data);
}


return $out;
curl -i -X GET "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&
  client_id={app-id}&
  client_secret={app-secret}&
  fb_exchange_token={short-lived-user-access-token}"
star

Mon Mar 06 2023 08:58:02 GMT+0000 (Coordinated Universal Time)

#elastic #curl #xargs
star

Sun Feb 26 2023 12:48:26 GMT+0000 (Coordinated Universal Time)

#keycloak #curl #token
star

Tue Jan 24 2023 09:43:45 GMT+0000 (Coordinated Universal Time)

#bash #sh #shell #curl #http
star

Sun Jun 05 2022 15:04:27 GMT+0000 (Coordinated Universal Time)

#curl
star

Thu Jun 24 2021 13:53:56 GMT+0000 (Coordinated Universal Time)

#modx #instagram #curl #json #array #tpl
star

Sat Jun 19 2021 06:39:59 GMT+0000 (Coordinated Universal Time) https://developers.facebook.com/docs/pages/access-tokens/#get-a-long-lived-user-access-token

#curl

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension