I have installed this php script on one my server "A". It's sending data to the authenticated server "B" 'http://example.com:80/file.php' and the server gives a token that could be used to see the servers content. But the problem is the server "B" is generating token for the server "A" (Network). I can see the server "B" content by using the server "A" token from my computer/android if I use my localhost(xampp) as server "A" but I can't see any content if I put the php script on any HOSTING. I will be glad if anyone gives a solution. Thanks in advance.
<?php
try {
$ch = curl_init('http://example.com:80/file.php');
//curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: example.com', 'Connection: Keep-Alive', 'Authorization:Basic encrypted-auth'));
curl_setopt($ch, CURLOPT_USERAGENT, 'Dalvik/2.1.0 (Linux; U; Android 8.0.0; SM-G955F Build/R16NW)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
$output = curl_exec($ch);
if (FALSE === $output) {
print_r("curl_error:" . curl_error($ch));
print_r("curl_errno:" . curl_errno($ch));
}
curl_close($ch);
print_r($output);
} catch (Exception $e) {
print_r($e->getCode());
print_r($e->getMessage());
}
?>