Lumen API with OAuth function, Gozzle get / post

I create a Lumen API with OAuth2 authentication, I follow this guide: http://esbenp.imtqy.com/2015/05/26/lumen-web-api-oauth-2-authentication/ , but I get an error message:   "Fatal error: Maximum execution time of 60 seconds exceeded in C:\Users\user\Desktop\api\lumen\vendor\guzzlehttp\guzzle\src\Handler\CurlMultiHandler.php on line 99"
Method Gazle email (and get method too) doesn't work for me

$app->get('api', function() use ($app) {
$client   = new \GuzzleHttp\Client();
$response = $client->get('localhost:8000/api/hello');
return $response;
});

$app->get('api/hello', function() use ($app) {
return "Hello";
});

get the same errors

+4
source share
1 answer

I solved my problem:

POST and GET requests from my API to my API do not work, because I used

php artisan serve

therefore, requests from localhost: 8000 / api to localhost: 8000 / api / hello do not work, but GET requests from localhost: 8000 / api to http://www.google.com/ did. Example:

$app->get('api', function() use ($app) {
$client   = new \GuzzleHttp\Client();
$response = $client->get('http://www.google.com/');
return $response;
});


Lumen API localhost www/folder (C:\wamp\www windows /var/www/html/on linux)

$app->get('api', function() use ($app) {
$client   = new \GuzzleHttp\Client();
$response = $client->get('localhost/api/hello');
return $response;
});

$app->get('api/hello', function() use ($app) {
return "Hello";
});

.

, , Lumen API ( ):
Lumen C:\wamp\www\api .htaccess , : C:\wamp\www\api \.htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
</IfModule>

C:\wamp\www\api\server.php C:\wamp\www\api\index.php
C:\wamp\www\api\public\index.php

$app->run();

$request = Illuminate\Http\Request::capture();
$app->run($request);

mod_rewrite!

+4

All Articles