-
Notifications
You must be signed in to change notification settings - Fork 0
Z2. PHP (file_get_contents)
Yohannes Mekonnen edited this page Sep 5, 2023
·
1 revision
$data = [
'username' => 'your_username',
'password' => 'your_password',
'to' => '251xxxxxxxxx',
'text' => 'your_message',
];
$jsonData = json_encode($data);
$contextOptions = [
'http' => [
'method' => 'POST',
'header' => [
'Content-Type: application/json',
'Content-Length: ' . strlen($jsonData)
],
'content' => $jsonData
]
];
$context = stream_context_create($contextOptions);
$response = file_get_contents('your_single_url', false, $context);
if ($response === false) {
echo 'Request failed';
} else {
// Handle the response as needed
}
$data = json_encode(array(
"username" => "your_username",
"password" => "your_password",
"to" => ["9xxxxxxxxx", "9xxxxxxxxx", "9xxxxxxxxx"],
"text" => "your_message"
));
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => $data
)
);
$context = stream_context_create($options);
$response = file_get_contents('your_list_url', false, $context);
if ($response === false) {
echo "Error fetching data.";
} else {
// Handle the response as needed
}