Reputation: 7799
I know how to get the source code but the website that I have been working on uses PHP session, this mean that you will need to login(which I have) and use the session ID that the server send back. How do I do this?
Upvotes: 2
Views: 4561
Reputation: 57956
Assuming you meant Session
, you'll need CookieContainer
:
CookieContainer cookies = new CookieContainer();
HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create(someSite);
getRequest.CookieContainer = cookies;
getRequest.Method = "GET";
HttpWebResponse form = (HttpWebResponse)getRequest.GetResponse();
using (StreamReader response =
new StreamReader(form.GetResponseStream(), Encoding.UTF8))
{
formPage = response.ReadToEnd();
}
You first make a GET
request to server and it'll return your SessionID in a cookie. If you need to make new requests to same server, you must pass it through and server will identify you as a returning user.
Upvotes: 5