curl-users
Curl, Php and NGinx
Date: Mon, 26 Mar 2018 21:28:43 -0400
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);
?>
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-03-27