curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl, Php and NGinx

From: Robert Lefebure <robert.r.lefebure_at_gmail.com>
Date: Mon, 26 Mar 2018 21:35:54 -0400

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> 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
> 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