Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat would cause curl to return false when trying to access a local file?
    primarykey
    data
    text
    <p>This site has been up for several months now and has been working fine. I have a PHP page that creates an invoice from data in the url (e.g. viewinvoice.php?id=250 builds an invoice based on record 250). This page is accessible via a web browser and works fine.</p> <p>On a completely different page (i.e. test.php) I'm trying to access that file via cURL. However, when I make the call and var_dump the results, I get bool(false). </p> <p>Here's the function that makes the cURL call:</p> <pre><code>function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); return $data; } </code></pre> <p>HOME is a constant that denotes the full url (e.g. <a href="http://www.example.com/" rel="noreferrer">http://www.example.com/</a>).</p> <pre><code>$invoice_contents = file_get_contents_curl(HOME.'viewinvoice.php?id=242'); echo $invoice_contents; var_dump( $invoice_contents ); </code></pre> <p>I've tried changing the url to an external url (i.e. <a href="http://www.google.com/" rel="noreferrer">http://www.google.com/</a>) and the page loads just fine. I get google's home page. But any page that's in the same domain won't load. Is there a reason that this would happen?</p> <p>I am not the server admin, but I have root access to the server. I have not changed any settings recently, but the server admin may have upgraded the version of apache or php?</p> <p>In any case, is there a setting I can modify to make this work again?</p> <p>P.S. I just tried making this exact call from an external server (different domain) and it works just fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload