I have a class in CakePHP with several methods that contain these two lines:
App::import('Core', 'HttpSocket');
$HttpSocket = new HttpSocket();
Which is then called
$result = $HttpSocket->post('http://domain.com', $dataArr);
How can I put the first two lines in to a class variable $socket which will then allow me to do
$result = $socket->post("http://domain.com", $dataArr);
I’m not sure if it should go in a __construct or … ?
it should be something like this:
hope this helps