I have a Cakephp 2.7 app that is outputting some json which I want to use on another site. The action is publicly allowed by auth in the beforeFilter...
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('api_feed');
}
public function api_feed(){
$properties = $this->Property->find('all');
$this->set('properties',json_encode($properties));
$this->layout = 'ajax'; //default cake ajax layout.
header('Content-Type: application/json');
}
The api_feed.ctp view file...
echo $properties;
The site that is consuming the feed is a new Wordpress Multi-site.
I've spent most of my time messing around with the syntax on the Cake output. I've tried just echoing the data with exit.
I am able to fetch the data from my local dev environment using any and all of the following: curl, file_get_contents, wp_remote_get. It shows in the browser as well, when logged out.
However, from my production server, I get nothing but drama.
Using curl
:
"NULL"
Using file_get_contents
:
Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Using wp_get_remote
:
Missing method in the controller error from Cakephp
In PHP, I have allow_url_fopen = on
, allow_url_include = on
.
The production server is a Digital Ocean VPS.
I'm at wits end. Any ideas on what I'm missing, or suggestions on where to look for answers?