a few questions

Discussion in 'iOS Programming' started by chhoda, Mar 28, 2009.

  1. chhoda macrumors 6502

    Joined:
    Oct 25, 2008
    #1
    Hi All,

    Can I do the following in http ? how ?

    how can i post an useragent in my http request ?
    how can i post an referer in my http request ?
    is there a regex type which I can use to find patterns in an http response ?


    regards
    CH
     
  2. chhoda thread starter macrumors 6502

    Joined:
    Oct 25, 2008
    #2
    bit more clearer

    Let me be bit cleaer. I found a regex framework, i can use that probably for regex.

    I need to translate a piece of c# code which works for me

    NameValueCollection postToLogin = new NameValueCollection();
    postToLogin.Add("login", login);
    postToLogin.Add("passwd", credential.Password);

    webClient.Headers[HttpRequestHeader.UserAgent] = _userAgent;
    webClient.Headers[HttpRequestHeader.Referer] = _loginPage;
    webClient.Encoding = Encoding.UTF8;
    webClient.Headers[HttpRequestHeader.Cookie] = webClient.ResponseHeaders[HttpResponseHeader.SetCookie];

    webClient.UploadValues(_authUrl, postToLogin);
    string cookie = webClient.ResponseHeaders[HttpResponseHeader.SetCookie];


    any ideas please

    --CH
     

Share This Page