Discussion:
Curl, Php and NGinx
(too old to reply)
Robert Lefebure
2018-03-27 01:28:43 UTC
Permalink
Raw Message
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);

?>
Robert Lefebure
2018-03-27 01:35:54 UTC
Permalink
Raw Message
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 <
Post by Robert Lefebure
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);
?>
Bill Mercer
2018-03-27 16:16:28 UTC
Permalink
Raw Message
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-***@cool.haxx.se] On Behalf Of Robert Lefebure
Sent: Monday, March 26, 2018 21:36 PM
To: the curl tool <curl-***@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 <***@gmail.com<mailto:***@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);

?>
Robert Lefebure
2018-03-27 17:29:31 UTC
Permalink
Raw Message
Sorry, and thanks!
Post by Bill Mercer
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/
*Robert Lefebure
*Sent:* Monday, March 26, 2018 21:36 PM
*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 <
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
Loading...