Robert Lefebure
2018-03-27 01:28:43 UTC
I've built a new, Nginx development server (first one) and have curl
working in one of the virtual servers (the default one).
There are two other virtual servers besides the default 1) example.com and
2) grouper.com
Everything is local.
This simple curl script works from localhost will work
<?php
echo '$_SERVER[DOCUMENT_ROOT] = ', $_SERVER['DOCUMENT_ROOT'];
$file="localhost/oldindex.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo($data);
//include ($file);
?>
but this one attempting to access the duplicate file on the other virtual
host won't
<?php
echo '$_SERVER[DOCUMENT_ROOT] = ', $_SERVER['DOCUMENT_ROOT'];
$file="https://grouperads.com/grouper_links/oldindex.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo($data);
//include ($file);
?>
working in one of the virtual servers (the default one).
There are two other virtual servers besides the default 1) example.com and
2) grouper.com
Everything is local.
This simple curl script works from localhost will work
<?php
echo '$_SERVER[DOCUMENT_ROOT] = ', $_SERVER['DOCUMENT_ROOT'];
$file="localhost/oldindex.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo($data);
//include ($file);
?>
but this one attempting to access the duplicate file on the other virtual
host won't
<?php
echo '$_SERVER[DOCUMENT_ROOT] = ', $_SERVER['DOCUMENT_ROOT'];
$file="https://grouperads.com/grouper_links/oldindex.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo($data);
//include ($file);
?>