Hey man, can you clarify #2 a bit? What do you mean by you want to login, but not go to the actual site? There's a post setting you can set
php
<?php
$c = curl_init();
$url = $_GET['url'];
CURL_SETOPT($c, CURLOPT_URL, $url);
CURL_SETOPT($c, CURLOPT_RETURNTRANSFER, 1);
CURL_SETOPT($c, CURLOPT_FOLLOWLOCATION, 1);
CURL_SETOPT($c, CURLOPT_HEADER, 0);
CURL_SETOPT($c, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($c, CURLOPT_POST, 1);
$postfield = "field=answer1&field2=answer2";
// Change 'field' to whatever the variable is in the form you're posting to
// answer would contain the data to be posted
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfield);
$result = CURL_EXEC($socket);
CURL_CLOSE($socket);
echo $result;
?>
That's how you send some post data to another site, and is what you would do to login.
Remember that sites like MySpace use a token to keep track of your session. Often times you'll need to do some regex to find that token on the next page, and pass it through the postfields as well.
Actually, explaining #1 a bit better might be beneficial too.
This post has been edited by akozlik: 7 Oct, 2008 - 07:13 AM