function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Send queries to a website that requires username and password, using HTTP Post

Hi All,

I would like to provide a link for each contact, this link is to a page which provides information about this person based one a  variable.

MY Problems: this page requires username and password (which are submitted via HTTP POST), and returns a cookie containing a SID (session ID).  SID is passed via the URL, and via HTTP POST, and if they don't match, then an error page is displayed.

I've included the HTTP request below. the request is of type POST, but it seems that the session ID also appears in the URL.

Any Ideas on how I can do this?
Even If I instruct the user to log on to the website in a seperat browser window, I wouldn't know how to add the SID fromt the cookie to the salesforce link. perhaps this can be done in Javascript?
and how to make the request using HTTP Post from salesforce?

Any help/ code / hints would be much appriciated.


(Note, I've changed the hostname and SID below, in order to protect aginst complaints from the data host)

(Red marks my variable, by which I want to submit the query, Blue marks the session / cookie ID),

URL: (here you see that the SID is in the URL)
HTTP Header:
POST /cardholder.wes—subpage=basic&__SID=3400014 HTTP/1.1
User-Agent: Mozilla/5.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pt-PT,pt;q=0.7,chrome://global/locale/;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

Cookie: PROD_SID_COOKIE=3400014
Content-Type: application/x-www-form-urlencoded
Content-Length: 50

There is a very simple cookie
Value 3400014
Path /
Secure No
Expires At End Of Session



I've done this using a simple link button that includes the variables that I want to pass from SFDC to our internal website to pull a profile for the client being viewed in SFDC.  Doing it this way, if the user is already logged into our internal site, they pull up the profile immediately.  If they're not logged in, they hit the login screen which, after credentials are entered, they re-direct to the profile page.