<p>Found a solution. I needed to set the requireUserAgentAndIpForSession to false,  <a href="http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession" rel="nofollow">http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession</a> </p>

<p>Seems like having to disable this for a particular url could open up other issues across the board.</p>

CC BY-SA 3.0
2014-10-08T01:51:32.477Z
2014-10-08T01:51:32.477Z
Derrick Grigg
<p>I'm trying to load a page from a Craft based website using file_get_contents or cURL. Using <code>get_file_contents</code> I get an empty result, using cURL I can see that the request is getting redirected to the login page.</p>

<p>If I switch to a different domain that is also running Craft the <code>file_get_contents</code> and cURL both work fine.</p>

<p>Any idea what could possibly be causing the redirect to be happening?</p>

<plugin-development><plugins>
Using cURL or file_get_contents is empty when calling a Craft page
# Using cURL or file_get_contents is empty when calling a Craft page

(Asked by: username_0 on 2014-10-08)

I'm trying to load a page from a Craft based website using file\_get\_contents or cURL. Using `get_file_contents` I get an empty result, using cURL I can see that the request is getting redirected to the login page.

If I switch to a different domain that is also running Craft the `file_get_contents` and cURL both work fine.

Any idea what could possibly be causing the redirect to be happening?

**Tags:** plugin-development, plugins


---

## 1 answers

### Answer by username_0 on 2014-10-08. Score: 2

Found a solution. I needed to set the requireUserAgentAndIpForSession to false, <http://buildwithcraft.com/docs/config-settings#requireUserAgentAndIpForSession>

Seems like having to disable this for a particular url could open up other issues across the board.


---

