1. Go to this page and download the library: Download bazarin/bazarin-php-library library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$fileGetContent = new FileGetContent('https://example.com');
$data = $fileGetContent->get_content();
print_r($data); // Output the parsed JSON payload
// Include the class file
n
$fileHandler = new FileGetContent('https://your-frontend-domain.com');
// Retrieve the JSON content from the request
$data = $fileHandler->get_content();
// Process the incoming data
if ($data) {
echo json_encode([
'status' => 'success',
'message' => 'Data received successfully',
'data' => $data,
]);
} else {
echo json_encode([
'status' => 'error',
'message' => 'Invalid or missing JSON payload',
]);
}
$crypt = new Crypt("my_secret_key"); // Initializes with the encryption key
$crypt = new Crypt("my_secret_key");
$plaintext = "Hello, this is a secret message!";
$encryptedData = $crypt->encrypt($plaintext);
echo $encryptedData; // Encrypted data in base64 format
$crypt = new Crypt("my_secret_key");
$encryptedData = "base64_encrypted_data_with_iv"; // The base64-encoded encrypted string
$decryptedData = $crypt->decrypt($encryptedData);
echo $decryptedData; // Decrypted message
$crypt = new Crypt("my_secret_key");
$plaintext = "Sensitive information that needs encryption.";
$encrypted = $crypt->encrypt($plaintext);
echo $encrypted;
$crypt = new Crypt("my_secret_key");
$encryptedData = "base64_encrypted_string";
$decrypted = $crypt->decrypt($encryptedData);
echo $decrypted; // Should display the original plaintext
try {
// File to be uploaded
$file = $_FILES['file'];
// Destination path
$destination = 'uploads/' . basename($file['name']);
// Optional validation for file type and size
$allowedTypes = ['image/jpeg', 'image/png'];
$maxSize = 2000000; // 2MB
// Attempt to upload the file
$uploadedFile = FileHelper::upload($file, $destination, $allowedTypes, $maxSize);
echo "File uploaded successfully: $uploadedFile";
} catch (\Exception $e) {
// Handle any errors that occur during the upload
echo "Error: " . $e->getMessage();
}
try {
// Format a date string to the default format (Y-m-d)
$formattedDate = DateHelper::format('2024-11-29');
echo $formattedDate; // Output: 2024-11-29
// Format a date string with a custom format (d/m/Y)
$formattedDate = DateHelper::format('2024-11-29', 'd/m/Y');
echo $formattedDate; // Output: 29/11/2024
// Format a DateTime object with a custom format (l, F j, Y)
$date = new \DateTime('2024-11-29');
$formattedDate = DateHelper::format($date, 'l, F j, Y');
echo $formattedDate; // Output: Friday, November 29, 2024
} catch (\Exception $e) {
// Handle any errors that occur during the date formatting
echo "Error: " . $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.