Last active
March 27, 2023 20:35
-
-
Save sunny/f4f18f577f1d9f0a92d4ab018ca61873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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