I am trying to create a PHP bot for a project for my cs classs that will automatically log me in to a site and perform certain tasks once that is complete. I have been doing some research and I believe the best way to acomplish this would be wish cURL however I am new to PHP so I may be taking the wrong approach. Here is what I have so far:
<?php
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://www.mywebsite.com");
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, "usr=username&pswd=password");
curl_exec($curl);
echo curl_error($curl);
curl_close($curl);
?>
When I run this script I just get a broken link error in my browser, can anyone offer any suggestions? Thanks for your help.