php - How to get webpage session value using C# -


i have php website stores values in session.

can these values independent c# program (on same machine , time)?

other option (if above not possible) current textbox value c# variable (again, if possible).

you can build api.

session_start(); if(isset($_get['action']) && $_get['action'] == "getsession") {    echo json_encode($_session); } 

then can call api via c# program.

// returns json string string get(string url)  {     httpwebrequest request = (httpwebrequest)webrequest.create(url);     try {         webresponse response = request.getresponse();         using (stream responsestream = response.getresponsestream()) {             streamreader reader = new streamreader(responsestream, encoding.utf8);             return reader.readtoend();         }     }     catch (webexception ex) {         webresponse errorresponse = ex.response;         using (stream responsestream = errorresponse.getresponsestream())         {             streamreader reader = new streamreader(responsestream, encoding.getencoding("utf-8"));             string errortext = reader.readtoend();             // log errortext         }         throw;     } } 

the call url like: get("http://localhost/api.php?action=getsession")

for security reason prefer add security code api.


Comments