title: [PHP]Curl preg_match_all extract the html tags
body: <p>I wrote the following PHP Code:</p>
  
  <pre><code>$postdata = 'username=userXXXX&amp;password=passXXXX';
  
  $ch = curl_init('website.com/user/login');  
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);  
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');
  curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
  curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
      $string = curl_exec ($ch);  
      curl_close($ch);
  
      //print_r($string);
  </code></pre>
  
  <p>Sometimes when i reload the script like 6-7 times, i have to complete an Captcha.</p>
  
  <p>What i need? I need to get the catpcha into my script to complet it manually if it will appear.</p>
  
  <p>There are the HTML tags of the captcha:</p>
  
  <pre><code>&lt;div class="content-bg-bottom"&gt;
              &lt;h2&gt;Security Code&lt;/h2&gt;
              &lt;div class="inner-form-border"&gt;
                  &lt;div class="inner-form-box"&gt;
                      &lt;h3&gt;Confirm the Login&lt;/h3&gt;
                      &lt;p&gt;Please write the following captcha code for get into your account.&lt;/p&gt;
                      &lt;form name="captchaForm" id="captchaForm" action="http://website.com/captcha" method="post"&gt;
                                                      &lt;div id="captchaContainer"&gt;
                              &lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
  $(document).ready(function() {
      $('#reloadCaptcha').bind('click', function() {
          var d = new Date();
          $('#captchaImage').attr('src', 'http://website.com/captcha/create?' + d.getTime());
      });
  });
  /* ]]&gt; */
  </code></pre>
  
  <p></p>
  
  
      
      
  
  <pre><code>                            &lt;label for="answer"&gt;Security Code: *&lt;/label&gt;
                              &lt;input class="validate[required]" id="answer" name="answer" title="" value="" maxlength="10" type="text"&gt;
                          &lt;/div&gt;
                          &lt;input id="submitBtn" class="btn-big" name="SubmitCaptchaForm" value="Trimite" type="submit"&gt;
                          &lt;script type="text/javascript"&gt;
                                                          &lt;/script&gt;
                      &lt;/form&gt;
                      &lt;p id="regLegend"&gt;* obligatory fields&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>