Skip to content

Instantly share code, notes, and snippets.

@sunny
Last active March 27, 2023 20:35
Show Gist options
  • Save sunny/f4f18f577f1d9f0a92d4ab018ca61873 to your computer and use it in GitHub Desktop.
Save sunny/f4f18f577f1d9f0a92d4ab018ca61873 to your computer and use it in GitHub Desktop.
<?php
$query = <<<'JSON'
{
creationsBatch(limit: 3) {
results {
name(locale: EN)
url
creator {
nick
}
}
}
}
JSON;
$variables = [];
$user = 'USER';
$password = 'PASSWORD';
$json = json_encode(['query' => $query, 'variables' => $variables]);
$request = curl_init();
curl_setopt($request, CURLOPT_URL, 'https://cults3d.com/graphql');
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($request, CURLOPT_HEADER, true);
curl_setopt($request, CURLOPT_VERBOSE, true);
curl_setopt($request, CURLOPT_POSTFIELDS, $json);
curl_setopt(
$request,
CURLOPT_HTTPHEADER,
array(
'User-Agent: PHP Script',
'Content-Type: application/json;charset=utf-8',
'Authorization: Basic ' . base64_encode($user . ':' . $password)
)
);
$response = curl_exec($request);
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment