CURL not working — check for HTTPS before emulating browser requests
CURL requests to certain URLs that were working fine seemed to stop working overnight.
The requests seemed to go through fine on the browser.
After monitoring network requests and getting CURL to emulate browser requests using user agent headers, it turned out that the said server had simply stopped servicing HTTP requests.
Browser requests were being redirected to HTTPS.
CURL requests were not.
All that needed to be done was convert the HTTP requests to HTTPS.
The requests seemed to go through fine on the browser.
After monitoring network requests and getting CURL to emulate browser requests using user agent headers, it turned out that the said server had simply stopped servicing HTTP requests.
Browser requests were being redirected to HTTPS.
CURL requests were not.
All that needed to be done was convert the HTTP requests to HTTPS.
Comments
Post a Comment