Skip to content

Instantly share code, notes, and snippets.

@srkraut
Created August 29, 2024 10:40
Show Gist options
  • Select an option

  • Save srkraut/dc6ee41e187741d83285285d23358c85 to your computer and use it in GitHub Desktop.

Select an option

Save srkraut/dc6ee41e187741d83285285d23358c85 to your computer and use it in GitHub Desktop.
ULTRA API
<?php
// Ensure you have HTTP_Request2 installed
require_once 'HTTP/Request2.php';
// Create a new request instance
$request = new HTTP_Request2();
$request->setUrl('https://portal.ultradisplayads.com/api/user');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
// Set headers, including Authorization and Cookies
$request->setHeader(array(
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJpbmZvQHhpYm9zaWduYWdlLmNvbSIsImF1ZCI6ImU0ZTI4ZWUzOWE5MTA2YzRjNDgwZmZmOGQ1ODg1MDBlYjUzMDhmY2YiLCJqdGkiOiI2YTM0YzRiMGViMmEwZjdiNTAwYThlMTEzODdiY2ZlNDQ2NWQ2ZGRkYTI4ZTc0NWIyMTUwYzIzYzAxNTcxODBjMTYxMjBhZWE1MjNlNmI0YiIsImlhdCI6MTcyNDkyNzAyOS40MTcxOTksIm5iZiI6MTcyNDkyNzAyOS40MTcyNDIsImV4cCI6MTcyNDkzMDYyOS40MTQwNTgsInN1YiI6IjEiLCJzY29wZXMiOlsiYWxsIl19.mkFYRNh9pxNbGi6zWcqJO4xNHf79G37YJFaz5fahT7KGZzs7MF5oOpaZf3fsC5gbKuZ10mINP8yM1h_Jq6u2-YeQntJXBWsni3M2DcQtz47pb6A-6NhaYiG_c0xEKPqFZjOuvpYAUy6TU4K2PvVQCya0uZxW421zXud2WbinR9iS5Rpy0I7j5h8kEpUi2x1f1JpcemOdPDhl4-vjrGQvd79M3AReQY8zk0pXFg8IZxAuyCNPmzQrr2sNUEEEnFFjl476Bi0Ud2ln-TL1uBZkFCUIBUwMX9SzumXWa4ShE1MmrQlxDYeQX_bEwRG7MXibUs35hM3gxE--OzlCDR9alg', // Replace with your actual Authorization key
));
// Add POST parameters
$request->addPostParameter(array(
'userName' => 'hello123',
'password' => '$Aroj2090@#$',
'email' => '[email protected]',
'userTypeId' => '3',
'libraryQuota' => '1048576',
'libraryQuotaUnits' => 'gb',
'groupId' => '1',
'homePageId' => 'icondashboard.view',
'homeFolderId' => '1'
));
try {
// Send the request
$response = $request->send();
// Check response status
if ($response->getStatus() == 200) {
echo $response->getBody(); // Output the response body
} else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase();
}
} catch (HTTP_Request2_Exception $e) {
// Handle any errors that occurred during the request
echo 'Error: ' . $e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment