curl-users
RE: Curl, Php and NGinx
Date: Tue, 27 Mar 2018 16:16:28 +0000
This list is for the curl command line tool, you probably want to post this on the libcurl or curl/php list
https://curl.haxx.se/mail/
From: curl-users [mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Robert Lefebure
Sent: Monday, March 26, 2018 21:36 PM
To: the curl tool <curl-users_at_cool.haxx.se>
Subject: Re: Curl, Php and NGinx
That got sent before it got finished ... sorry about that!
I can access the https://grouperads.com/grouper_links/oldindex.php in a browser (locally) .
So is it something I have to configure Nginx to route local curl requests locally too? Or is there something I can do to Curl to make it find the local file through that address? I think curl is going out to the web trying to find that, right? Do I need to set curl to intercept it or Nginx to?
Thanks
On Mon, Mar 26, 2018 at 9:28 PM, Robert Lefebure <robert.r.lefebure_at_gmail.com<mailto:robert.r.lefebure_at_gmail.com>> wrote:
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<http://example.com> and 2) grouper.com<http://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