Laravel Http Client User-Agent header as -A

kq0g1dla  于 2023-05-20  发布在  其他
关注(0)|答案(1)|浏览(122)

我怎么能传递User-Agent头与一个特殊的 curl 参数-A,而不是-H


的数据
以下代码添加了带有-H参数的User-Agent,而不是-A

Http::withHeaders(['User-Agent' => 'Mozilla/5.0 (Android 13; Mobile; rv:109.0) Gecko/111.0 Firefox/111.0'])

字符串
此代码无效:

Http::beforeSending(function(Illuminate\Http\Client\Request $request) {
    $request->toPsrRequest()
        ->withHeader('User-Agent', 'Mozilla/5.0 (Android 13; Mobile; rv:109.0) Gecko/111.0 Firefox/111.0');
});

d7v8vwbk

d7v8vwbk1#

那又怎样

Http::withOptions([
    'CURLOPT_USERAGENT' => 'Mozilla/5.0 (Android 13; Mobile; rv:109.0) Gecko/111.0 Firefox/111.0',
]);

字符串

相关问题