当我向我的 Laravel 路由发出 cURL 请求时,它不仅仅是返回进程的内容,它实际上将我重定向到主页,返回这个 HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=http://erm.gratuz.net.com/api/requesthandler" />
<title>Redirecting to http://erm.gratuz.net.com/api/requesthandler</title>
</head>
<body>
Redirecting to <a href="http://erm.gratuz.net.com/api/requesthandler">http://erm.gratuz.net.com/api/requesthandler</a>.
</body>
</html>
我的 cURL 请求如下:
$url = "http://erm.gratuz.net.com/api/requesthandler/";
$session = curl_init( $url );
curl_setopt( $session, CURLOPT_HEADER, 0 );
curl_setopt( $session, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $session, CURLOPT_POSTFIELDS,$fields );
$response = curl_exec( $session );
curl_close( $session );
以下是接受post的路线
Route::any('/api/requesthandler', 'TestController@requesthandler');
任何帮助表示赞赏。