Reputation: 488
I'm new on amphp and i'd like to try this very simple code first. I downloaded amphp with composer for windows and save all folder created inside my project folder.
composer require amphp/http-client
Then my code is:
<?php
require __DIR__ . './autoload.php';
use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\HttpException;
use Amp\Http\Client\Request;
use Amp\Http\Client\Response;
use Amp\Loop;
$stringa = 'http://www.google.it/';
$request = new Request($stringa, "GET");
$location = $request->getHeader("Location");
var_dump($location);
But I get always 'Fatal error: Uncaught Error: Class 'Amp\Http\Client\Request' not found'
Any suggest?
I use wamp local server with php 7.0
Also ,after, I need to yield
all the code...
Upvotes: 3
Views: 695
Reputation: 416
Here are a few things that look for:
autoload.php
get included correctly?
.
before /autoload.php
.composer require amphp/http-client
so that the libraries will be installed?vendor/amphp/http-client
directory?\
in the require
statement.Apart from these, I can't think of why the library won't load. I hope this helps.
Upvotes: 0