Hi all! I'm at my wits end with a PHP script I'm using to retrieve friend lists from MySpace. I've been using cURL to post the _doPostBack data to MySpace and all was working flawlessly up until a few weeks ago. It seems that the simple cURL code I was using is no longer working, and I believe this has something to do with MySpace setting up msplinks redirection. So the problem I'm having now is when I use the following function, I get a 302😮bject Moved HTTP response:
$url = "http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendID=".$_POST['fid'];
$vars = "__EVENTTARGET=ctl00%24cpMain%24FriendsView_skin%24pagerTop&__EVENTARGUMENT=".$q."&__LASTFOCUS=&__VIEWSTATE=".$vsval."&___msPagerState=".$mspagerstate."&ctl00%24cpMain%24FriendsView_skin%24ddlHidden=0&ctl00%24cpMain%24FriendsView_skin%24selectedAlpha=&ctl00%24cpMain%24FriendsView_skin%24editMode=false";
function next_friendlist_post($url, $vars) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $vars);
$response = curl_exec ($ch);
curl_close ($ch);
$response = htmlspecialchars($response);
return $response;
}
Now, if I add CURLOPT_FOLLOWLOCATION, I get a .NET Error Page ("Sorry, a technial error has occured... forwarded to MySpace technical group... etc..."):
function next_friendlist_post($url, $vars) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $vars);
$response = curl_exec ($ch);
curl_close ($ch);
$response = htmlspecialchars($response);
return $response;
}
I'm hoping someone out there has been through this before and can possibly help me out. I'm running PHP 4.4.8 on Windows. Thanks in advance!