curl authorization header
curl -H "Authorization: token_str" http://www.example.com
curl authorization header
curl -H "Authorization: token_str" http://www.example.com
php curl basic auth
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$host = 'http://google.com';
$message = 'Test message';
$phone = '998999999';
$username = 'username';
$password = 'password';
$post = [
"messages" => [
[
"recipient" => $phone,
"message-id" => "itrust" . strval(time()),
"sms" => [
"originator" => "3700",
"content" => [
"text" => $message
]
]
]
]
];
$payloadName = json_encode($post);
$ch = curl_init($host);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payloadName);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($ch);
curl_close($ch);
echo '<pre>';
var_dump($return);
echo '</pre>';
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us