【发布时间】:2014-02-15 21:36:18
【问题描述】:
当我向我的 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');
感谢任何帮助。
【问题讨论】:
-
遇到同样的问题 - 想知道您是否知道发生了什么?
-
不幸的是,我没有 - 我将我的 curl 请求指向了一个不受 Laravel 控制的页面。
标签: php curl laravel-4 laravel-5.2