1

I am working on creating an application that is capable of logging into myspace accounts in order to automate things on myspace and inside of applications hosted on myspace.

I use this code in my php scripts to login to a myspace account

curl_setopt($ch = curl_init(), CURLOPT_URL, "https://www.myspace.com/auth/login");  
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)');   
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "formLocation=popupForm&hash=MIGcBgkrBgEEAYI3WAOggY4wgYsGCisGAQQBgjdYAwGgfTB7AgMCAAECAmYDAgIAwAQIzvUlf32XiZkEEEdO4p%252f8EKHJN%252fdOXnKVVcIEUKWnrWfUbv6Jk9HLwI9PjqtfMX%252fCWQApDLaJsH2ntEdJIcsEonDrhad4JCpLBfbLcDb7uo7p1XYlqJNIHme%252fw8m6%252fYfsjQr3k36C4Z8U1IEY&SMSVerifiedCookieToken=&NextPage=&js=-1&fbtoken=&Email=".urlencode($Email)."&Password=".urlencode($Password)."&Remember=true");
curl_setopt($ch, CURLOPT_REFERER,'http://www.myspace.com/');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
$Result = curl_exec($ch);

What would be the equivalent to this but in java?

1
  • Not quite sure why the code did not show up in code format, It is hard to read.. I apologize Commented Aug 24, 2011 at 11:30

1 Answer 1

1

May be the java.net.HttpURLConnection

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.