title: cURL - How to loop a task for multiple websites?
body: <p>I have a cURL script and I'm using it to update my web directory. I know that I can use RSS feeds (more friendly?) etc, but because this is my first script ever I would like to add a new features to it so I can improve my PHP skills:)</p>
  
  <p>Currenly my script is using cURL to:</p>
  
  <ol>
  <li>Login to admin panel [POST] </li>
  <li>Create a backup of existing page [POST] </li>
  <li>Update existing page with new content [POST]</li>
  </ol>
  
  <p><strong>Login</strong>:</p>
  
  <pre><code>$username="username";
  $password="admin";
  $url="http://domain.com";
  $cookie="cookie.txt";
  $postdata (...)
  </code></pre>
  
  <p>All cURLS are using same name: $ch = curl_init(); e.g.</p>
  
  <p>Login:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt (...)
  </code></pre>
  
  <p>Then backup</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt (...)
  </code></pre>
  
  <p>Then update</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt (...)
  </code></pre>
  
  <p>etc.</p>
  
  <p>I just installed two new web directories and would like to use my cURL script to update both in the same way. I know that I can copy all <strong>curl_inits</strong> and just change URLs but I can not imagine doing this if I have 10 new directories :)</p>
  
  <p>My question is: how i can create a loop so my cuRL will:</p>
  
  <ol>
  <li>Login -> backup page -> update page using <a href="http://domain1.com" rel="nofollow">http://domain1.com</a></li>
  <li>Login -> backup page -> update page using <a href="http://domain2.com" rel="nofollow">http://domain2.com</a> </li>
  <li>Login -> backup page -> update page using <a href="http://domain3.com" rel="nofollow">http://domain3.com</a></li>
  <li>Stop the loop when the last url has been processed.</li>
  </ol>
  
  <p>I'm new into PHP so please be patient :) 
  Cheers!</p>