Tim Joyce
Tim Joyce

Reputation: 4517

get model data from a folder outside of the cakePHP app folder

I have a site where the directories are set up like this

public_html/framework/cake
public_html/framework/app
public_html/index.php
public_html/contact.php
public_html/aboutus.php

Is there any way to get variables or model data from public_html/framework/app when a user navigates to public_html/aboutus.php?

Upvotes: 0

Views: 269

Answers (1)

Moz Morris
Moz Morris

Reputation: 6761

I would recommend reading the HttpSocket documentation.

An example implementation would look similar to:

/**
 * import HttpSocket class
 */
App::import('Core', 'HttpSocket');

/**
 * instantiate and make a POST request to http://localhost/contact.php
 * sending var1 => test
 */
$HttpSocket = new HttpSocket();
$HttpSocket->post('http://localhost/contact.php', array(
  array('var1' => 'test')
));

/**
 * response
 */
$response = $HttpSocket->response;

Upvotes: 1

Related Questions