I’ve added the http client call to a new controller and I feel like I’ve fallen at the most basic hurdle. I get this error from the code underneath it. Where have I gone wrong?
**Error:** Class Cake\Http\Client\Request contains 11 abstract methods and must therefore be declared abstract or implement the remaining methods (Psr\Http\Message\MessageInterface::getProtocolVersion, Psr\Http\Message\MessageInterface::withProtocolVersion, Psr\Http\Message\MessageInterface::getHeaders, ...)
**File** /var/www/www.nzpif.org.nz/public_html/vendor/cakephp/cakephp/src/Http/Client/Request.php
**Line:** 254
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Http\Client;
class AdlistingsController extends AppController {
public function index() {
$http = new Client();
// use a nothing page that's quick to "get"
$response = $http->get('https://www.propertyinvestor.info/');
debug($response);
}
}
It’s a “known app”, an old site which was upgraded from cake1 to cake3 in 2014.
The admin part is on cake2 and I could run these functions through the admin, I’m more comfortable with that version, I really haven’t liked the changes there. It just seems odd that the most basic request falls over.
Hmm… Well, the error is something you don’t control. That’s why I believe it is some ‘partial’ install problem. Like some class that is suppose to implement those 11 abstract methods is not available to do its job.
The problem with this theory is, there doesn’t seem to be a ‘file couldn’t be found’ message and if a missing file WAS causing this, I’d expect that evidence.
Have you looked at the core directory to verify any of the expected structure is there? One way to go would be to bake a brand new project of the same version, then visually confirm the existence of src/Http directory content.
A new, clean app would also give you a second place to try your code and see if it works. I would expect success if it is just an install problem of some kind.