0

How can I extract and store a value from a server response which is in the form of HTML? I am trying to make a post request for login that requires auth and this csrfmiddlewaretoken value. Below is a response server I receive after I make a Get request.

<div id="login_block">
  <div class="text-center"><img src="/static/img/logo-mool2016.black.7272bc78ba54.png" width="223"  alt=LOGO" onclick="showChooseLogin();"></div>
    <h3 class="text-center">Connectez-vous pour accéder à <span class="product-name">Tool Platform</span></h3>
  <div id="login_choosen" class="login_block ui-widget-content ui-corner-all">
   <form method="post" action="." id="login_form"><input type='hidden' name='csrfmiddlewaretoken' value='fLTzkLA7yhy7YKDvohM0PJstFJJCEk2JinfjOyzCe2NA495QKznLgO1wzi64P2S8' />
      <p><label for="id_email">Email :</label> <input class="login" id="id_email" maxlength="75" name="email" type="text" required /></p>
<p><label for="id_password">Password :</label> <input class="login" id="id_password" name="password" type="password" required /></p>
      <button type="submit" class="btn btn-connect pull-right">Connexion</button>
    </form>
  </div>
</div>
ludo
  • 543
  • 3
  • 14
  • You may need to parse HTML. Probably this will help ? https://stackoverflow.com/questions/31080818/what-is-the-best-practice-to-parse-html-in-swift – GoodSp33d Nov 14 '17 at 07:20
  • @GoodSp33d this seems like a good doc thanks. – ludo Nov 14 '17 at 11:19

0 Answers0