Search code examples
cakephpcakephp-2.6

An error "Class 'HttpSocket' Not Found" occured


I'm trying to update CakePHP from ver.1.3 to 2.6.

And I found an error using MyLibraryClass.

error is:

"Class 'HttpSocket' Not Found"

and code is:

<?php

class MyApiClient {

    public function __construct() {
        $this->socket = new HttpSocket();

So I added this line before class.

<?php
App::uses('HttpSocket', 'Network/Http');

class MyApiClient {

But error is still shown. Is there anyone who did deal with this case?


Solution

  • As per our discussion in comments you have added following code in app/Lib

    App::uses('HttpSocket', 'Network/Http');
    

    So please place the same in your required controller before class definition.