Ciao, ho una pagina php su un server che scarica uno stream json da una pagina php su un'altro server che a sua volta interroga il db. Il server 1 è un host windows su register.it, il server 2 è su un host linux di proprietà del cliente. Le pagine sono scritte in PHP 5.5
La pagina funziona perfettamente su NetBeans sul mio computer, sul server 1 la pagina si visualizza correttamente la il json è vuoto. Le pagine sul server 2 le ho testate e funzionano.
Pagina php su server 1
codice HTML:
<html>
<head>
<meta charset="UTF-8">
<title>TITOLO</title>
</head>
<body>
<link rel="stylesheet" href="css/mio1.css">
<?php
// BOTTONE
if (isset($_POST['bottone1'])) {
// 3 Opzioni che funzionano in locale ma non su server
// Opzione 1
$urlPhp = urlencode('http://server_2/pagina.php/');
$json = file_get_contents($urlPhp);
// Opzione 2
$json = file_get_contents('http://server_2/pagina.php/');
// Opzione 3
$arrContextOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ), );
$json = @file_get_contents( "http://server_2/pagina.php/", false, stream_context_create( $arrContextOptions ) );
// Scrivi JSON
echo "... json :".$json;
echo "<br>";
}
?>
<form method="POST" action=''>
<div id="log_bott">
<input type="submit" name="bottone1" value="TEST" id="log_bot" />
</div>
</form>
</body>
</html>
File Web.config su server 1
codice HTML:
<?xml version="1.0" encoding="UTF-8"?><configuration>
<system.web>
<identity impersonate="true" />
<trust level="Medium" />
</system.web>
</configuration>
Grazie.