You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the fetch method is not allowing almost any customization.
I found some webpages in which my requests were blocked because we were not sending the User-Agent header.
To do so, I copy pasted the fetch method and added the curl_setopt($curl, CURLOPT_USERAGENT, 'My User Agent/1.0'); option.
Alternatively, I think that sending an extra header like 'User-Agent: My User Agent/1.0' in the existing CURLOPT_HTTPHEADER option should have worked too.
I could have also done the request by myself and then used the parse method, but fetch includes some extra logic (checking content_type` and making sure the 'url' used is the correct one, that I would have had to replicate.
Proposal:
Make it possible to add extra headers (maybe as an optional extra parameter which is [] by default).
The text was updated successfully, but these errors were encountered:
Currently the
fetch
method is not allowing almost any customization.I found some webpages in which my requests were blocked because we were not sending the
User-Agent
header.To do so, I copy pasted the
fetch
method and added thecurl_setopt($curl, CURLOPT_USERAGENT, 'My User Agent/1.0');
option.Alternatively, I think that sending an extra header like
'User-Agent: My User Agent/1.0'
in the existingCURLOPT_HTTPHEADER
option should have worked too.I could have also done the request by myself and then used the
parse
method, butfetch
includes some extra logic (checking content_type` and making sure the 'url' used is the correct one, that I would have had to replicate.Proposal:
[]
by default).The text was updated successfully, but these errors were encountered: