Exists such thing as mozrepl for Safari?
If the main idea is scripting Safari, I would try using Automator before trying AppleScript. I'd start by hitting the record button and then:


Open Safari
Navigate to your webpage
GET by saving the webpage source
Allow the page to do whataver AJAX calls you may want it to do

save the webpage source again

Fill out a form, hit submit for your POST

save the webpage source yet again



Or you could try AppleScript with something like this:

tell application "Safari"
    tell window 1
    set current tab to (make new tab with properties {URL:"http://www.example.com"})
    end tell
end tell


You can add to the script form fills and submit buttons with javascript:

do JavaScript "document.getElementById('field').value = '" &amp; myvalue &amp; "'"
do JavaScript "document.forms[\"form\"].submit();"


I'd try this out within the JavaScript console within a web browser first to make sure you have the names of everything correct.