Skip to content

Instantly share code, notes, and snippets.

@wsandin
Created July 13, 2023 11:48
Show Gist options
  • Save wsandin/4c7c7f90dadb5950426a9a5bd3950d1f to your computer and use it in GitHub Desktop.
Save wsandin/4c7c7f90dadb5950426a9a5bd3950d1f to your computer and use it in GitHub Desktop.
migrationsverket.sh
# Request the first page and save the cookies to a file
curl -c cookies.txt 'https://www.migrationsverket.se/ansokanbokning/valjtyp?0&enhet=U0586&sprak=sv&callback=https:/www.swedenabroad.se'
# Now request the second page, using the cookies saved from the first request
curl -b cookies.txt -s 'https://www.migrationsverket.se/ansokanbokning/wicket/page?2' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
-H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'Cache-Control: max-age=0' \
-H 'Connection: keep-alive' \
-H 'Referer: https://www.migrationsverket.se/ansokanbokning/valjtyp?0&enhet=U0586&sprak=sv&callback=https:/www.swedenabroad.se' \
-H 'Sec-Fetch-Dest: document' \
-H 'Sec-Fetch-Mode: navigate' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-User: ?1' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--compressed | \
grep -E '<input.*disabled.*>' 2>&1>/dev/null || \
echo "Appointment available" | mail -s "Appointment Status" wsandin@email.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment