title: Waiting for CloudFlare DDOS Protection LWP Perl
body: <p>Edit: Ended up using WWW::Mechanize::Firefox. I answered my own question below.</p>
  
  <p>I am trying to access a website and download it's page. The cloudflare DDOS protection on the site will occasionally come on, and I can't make LWP go through it. I can successfully detect that a page <em>is</em> a cloudflare splash page with the regex <code>/Ray ID: [a-f0-9]*/</code> but whenever I attempt to connect again I just get the same splash screen with a new Ray ID. Here is a (condensed) code sample:</p>
  
  <pre><code>use LWP::UserAgent;
  $ua = LWP::UserAgent-&gt;new;
  $ua-&gt;agent('Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0');
  $signin_url = 'my url';
  $signin_page = $ua-&gt;get($signin_url);
  if($signin_page-&gt;content =~ /Ray ID: ([a-f0-9]*)/i) {
       print "DDOS protection page here\n";
       #more code to retry, but just gets back into this part of the IF
   } else {
       print "Not the DDOS page\n";
       #now I would save to file
  }
  </code></pre>
  
  <p>Since that doesn't work I need to be able to do it another way.</p>