$page1 = file_get_contents('http://www.google.com');
$page2 = file_get_contents('http://localhost:8000/prueba');
Run Code Online (Sandbox Code Playgroud)
当我回应结果时,谷歌它可以工作,但不适用于我的网站.当我把地址放在资源管理器上时.这发生在我在django制作的所有网站上.:(
警告:file_get_contents(http://localhost:8000/prueba)[function.file-get-contents]:无法打开流:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而建立连接失败.在第138行的C:\ xampp\htdocs\squirrelmail\plugins\captcha\backends\b2evo\b2evo.php中
致命错误:第138行的C:\ xampp\htdocs\squirrelmail\plugins\captcha\backends\b2evo\b2evo.php超出最长执行时间60秒
这是一个简单的代码snipplet,但这只是挂起和反应迟钝.
$httpClient = new GuzzleHttp\Client(); // version 6.x
$headers = ['X-API-KEY' => '123456'];
$request = $httpClient->request('GET', 'http://localhost:8000/BlogApiV1/BlogApi/blogs/', $headers);
$response = $client->send($request, ['timeout' => 2]);
echo $request->getStatusCode();
echo $request->getHeader('content-type');
echo $request->getBody();
die();
Run Code Online (Sandbox Code Playgroud)
任何指针都非常赞赏.当我使用我的用户名和密码尝试使用github api时,我得到了200响应和大量信息.
Laravel Passport Auth Stuck when run on self server and client in same project for password based token authentication
LoginController
public function authenticaterrr(Request $request)
{
$http = new Client();
try{
//dd("Hello");
$response = $http->post(url('oauth/token'), [
'form_params' => [
'grant_type' => 'password',
'client_id' => '2',
'client_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// 'username' => $request->get('username'),
// 'password' => $request->get('password'),
'username' => 'xxxxxx@xxxxx.com',
'password' => 'xxxxx',
'scope' => '*',
],
]);
// $apiResponse = json_decode((string) $response->getBody(), true);
// dd($apiResponse);
$apiResponse = json_decode((string) $response->getBody(), true);
dd($apiResponse); …Run Code Online (Sandbox Code Playgroud)