title: Login a website from another webpage with PHP
body: <p>So i have a  website <a href="http://example.com" rel="nofollow">http://example.com</a>
  And there is a website i would like to login; <a href="http://target.com" rel="nofollow">http://target.com</a>
  I want a script that can fill the login form (username and password) at <a href="http://target.com" rel="nofollow">http://target.com</a> FROM my site.</p>
  
  <p>so when a user click on <a href="http://example.com/login.php&amp;username=John&amp;password=12345" rel="nofollow">http://example.com/login.php&amp;username=John&amp;password=12345</a></p>
  
  <p>He should log in <a href="http://target.com" rel="nofollow">http://target.com</a> directly AND sent to the welcome page.</p>
  
  <p>I got this code;</p>
  
  <pre><code>$url = "http://target.com";
  $post = "username=John&amp;password=12345&amp;login=++Ba%F0lan++";
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  echo curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>BUT it's not forwarding me to the welcome page. instead it shows me an error on <a href="http://example.com" rel="nofollow">http://example.com</a> (page not found)</p>
  
  <p>ALSO it's not getting username and password data from url. but i think i will solve it on my own later.</p>
  
  <p>Any help?</p>