oh yea, you make a good point that it is okay on the windows server without it.
anyway, here is the curl code
<?php
class CurlHTTPRequest
{
var $cookieFile;
var $headers = array();
var $UserAgent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1';
var $useGZIP = FALSE;
var $lastUrl;
var $httpHeader;
var $httpBody;
var $ch;
function CurlHTTPRequest($cookieFile)
{
$this->ch = curl_init();
$this->cookieFile = $cookieFile;
}
function PostData($url, $postdata, $referer = '', $followlocation = TRUE)
{
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->UserAgent);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookieFile);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookieFile);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, $followlocation);
curl_setopt($this->ch, CURLOPT_HEADER, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
if ($referer != '')
curl_setopt($this->ch, CURLOPT_REFERER, $referer);
if ($this->useGZIP)
curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate');
else
curl_setopt($this->ch, CURLOPT_ENCODING, 'none');
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata);
$this->lastUrl = $url;
$resp = curl_exec($this->ch);
list($this->httpHeader, $this->httpBody) = explode("\r\n\r\n", $resp, 2);
}
function GetData($url, $referer = '', $followlocation = TRUE)
{
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_USERAGENT, $this->UserAgent);
curl_setopt($this->ch, CURLOPT_COOKIEFILE, $this->cookieFile);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookieFile);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, $followlocation);
curl_setopt($this->ch, CURLOPT_HEADER, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
if ($referer != '')
curl_setopt($this->ch, CURLOPT_REFERER, $referer);
if ($this->useGZIP)
curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate');
else
curl_setopt($this->ch, CURLOPT_ENCODING, 'none');
$this->lastUrl = $url;
$resp = curl_exec($this->ch);
list($this->httpHeader, $this->httpBody) = explode("\r\n\r\n", $resp, 2);
}
function SetHeader($key, $value)
{
$this->headers[] = "$key: $value";
}
function SetUserAgent($useragent)
{
$this->UserAgent = $useragent;
}
function SetProxy($proxy)
{
curl_setopt($this->ch, CURLOPT_PROXY, $proxy);
}
function RemoveProxy()
{
curl_setopt($this->ch, CURLOPT_PROXY, '');
}
}
?>
and the login code...
<?php
define('USERNAME', 'you@youremail.com');
define('PASSWORD', 'password');
require_once 'curl.php';
$curl = new CurlHTTPRequest(USERNAME . '.txt'); // make sure the server can write to the current directory.
$curl->GetData('http://www.myspace.com/');
preg_match('/MyToken=([^"]+)"/', $curl->httpBody, $token);
$curl->PostData("http://login.myspace.com/index.cfm?fuseaction=login.process&MyToken={$token[1]}", 'email=' . USERNAME . '&password=' . PASSWORD . '&loginbutton.x=5&loginbutton.y=5');
//echo $curl->httpBody;
if (preg_match('@Cool New People</h5>\s+<div[^>]+>\s+<a href="([^"]+)"><span>([^<]+)</span>@is', $curl->httpBody, $furl)) {
echo "Logged in\n";
} else {
echo "Didn't log in";
?>
this has worked for me in the past, i haven't tried it out for a few months, but it was okay then. hopefully it can help you out.