Making POST/PUT Requests

Some advanced users may want to send POST/PUT requests in order to scrape forms and API endpoints directly. You can do this by sending a POST/PUT request through ScraperAPI. The return value will be stringified. So if you want to use it as JSON, you will need to parse it into a JSON object.

  • API ENDPOINT REQUEST

# Replace POST with PUT to send a PUT request instead
curl -d 'foo=bar' \
-X POST \
"http://api.scraperapi.com/?api_key=APIKEY&url=http://httpbin.org/anything"

# For form data
curl -H 'Content-Type: application/x-www-form-urlencoded' \
-F 'foo=bar' \
-X POST \
"http://api.scraperapi.com/?api_key=APIKEY&url=http://httpbin.org/anything"
  • PROXY MODE

//Replace POST with PUT to send a PUT request instead
curl -d 'foo=bar' \
-X POST \
-x "http://scraperapi:APIKEY@proxy-server.scraperapi.com:8001" -k "http://httpbin.org/anything"

//For form data
curl -H 'Content-Type: application/x-www-form-urlencoded' \
-F 'foo=bar' \
-X POST \
-x "http://scraperapi:APIKEY@proxy-server.scraperapi.com:8001" -k "http://httpbin.org/anything"
  • ASYNC MODE

You need to send a POST request to the Async service. The details of the POST request you want to send to the target site are in the data

curl \
-X POST \
-H 'content-type: application/json' \
--data '{"apiKey": "APIKEY", "url": "https://httpbin.org/anything", "method": "POST", "headers": {"content-type": "application/x-www-form-urlencoded"},  "body": "foo=bar"}' \
'https://async.scraperapi.com/jobs'

Last updated