Ben 2 farklı sunucularda 2 dosyaları var:
file1.php - resides on site 1 - I pass a parameter, and the script echo-ed answer which depends on (is function of) passed parameter - everithink is OK when I access file by browser like
http://site1.com/file1.php?parameterValue
file2.php - resides on site 2 - file2 has to send a parameter to file1.php AND get echo-ed output from it as variable.
Ben 3 ayrılmakta yollardan bunu yapmaya çalıştım ama hiçbir olanları çalıştı.
1. yol. -------
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$f="http://site1.com/file1.php?parameterValue";
$returned_content = get_data($f);
echo "=== $returned_content ===";exit;
yolu 2. -------
$f="http://site1.com/file1.php?parameterValue";
$returned_content='';
$file = fopen ($f, "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
while (!feof ($file)) $returned_content.= fgets ($file, 1024);
fclose($file);
echo "=-= $returned_content =-=";exit;
yollu 3. -------
$f="http://site1.com/file1.php?parameterValue";
$returned_content=implode('',file($f));
echo "=-= $returned_content =-=";exit;
AMA $ returned_content boş dize ...
Can anybody help me? Thanks in advance!
Hristo