<?php
// URL of the Yealink phone
$url = 'http://<your_yealink_phone_ip>/servlet?';
// Set the parameters for logging in
$params = array(
'username' => '<your_username>',
'password' => '<your_password>',
'action' => 'login'
);
// Initialize cURL session
$ch = curl_init();
// Set the cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute cURL session
$response = curl_exec($ch);
// Check for errors
if ($response === false) {
echo 'cURL error: ' . curl_error($ch);
} else {
echo 'Response: ' . $response;
}
// Close cURL session
curl_close($ch);
?>