Logging in:
Code: <?php
class Myspace
{
function login($username, $password)
{
$username = $_POST['user'];
$password = $_POST['passwd'];
$login_url = "https://secure.myspace.com/index.cfm?fuseaction=login.process";
$post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=$username&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=$password";
$ch = curl_init($login_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) ");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
}
if($_POST['user'] && $_POST['passwd'])
{
$login = new Myspace;
echo $login->login($_POST['user'],$_POST['passwd']);
}
else
{
echo
"<html>
<body>
<form action='connect.php' method='POST'>
<input type='text' name='user' /><br />
<input type='password' name='passwd' /><br />
<input type='submit' value='submit' />
</form>
</form>
</body>
</html>";
}
?>
This works fine, the output gives me the main home screen of myspace.
Posting the status:
Code: <?php
class Post
{
function StatusUpdate()
{
$url = "http://home.myspace.com/Modules/PageEditor/Handlers/Home/SaveStatusMood.ashx";
$post_data = urlencode("status=cheeellin&mood=(none)&smiley=http://x.myspacecdn.com/modules/common/static/img/spacer.gif");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2)");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
}
$post = new Post;
echo $post->StatusUpdate();
?>
This is where the problem is. I can't figure out why, but for some reason this will not suffice to bringing about a change in the status of my profile. I'm fairly certain that the cookie is working properly, as viewing the home screen with the sole use of the cookie rather than logging in works fine. Maybe there are more cookie parameters that I am missing which myspace looks for before accepting a status update?
How Myspace handles status updates(XXX = omitted data:)
Code: POST /Modules/PageEditor/Handlers/Home/SaveStatusMood.ashx HTTP/1.1
Host: home.myspace.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Hash: XXX
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://home.myspace.com/index.cfm?fuseaction=user
Content-Length: 94
Cookie: XXX
Pragma: no-cache
Cache-Control: no-cache
This is what I found out from firebug. I might just have to inspect the cookies a bit more to make sure there aren't any problems, but other than that I see no reason why the php code shouldn't work, assuming that there is a cookie in the txt file that has not expired before running such code
Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
PHP File Upload Problem
Hi, I have written a very simple file upload script but it fails for reasons I can't explain. Hopefully someone here can help me out. I have checked php.ini and file uploads are on with a limit of
Limiting checkboxes?
Hi guys, I have this code: Code: if(isset($_POST['selected'])) { foreach($_POST['selected'] as $item) { $sql = "SELECT * FROM tablename WHERE ID=$item"; mysql_query($sql) or
check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.
Not adding to db
Hi, I can't figure out why it won't add the record to the database. It's just a simple form to get name and email but when I hit submit I get the "or die" message. Code: $Fname =
understanding functions and classes
Code: [Select]class person { var $name = "Jimmy Goe"; function get_name(){ echo $this->name; }} I am playing with this very small script that I made using a
Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I have been working on this problem for 3 days and have had no luck!Here we go:I have a rate and
Coding question?
Hey guys, I have a quick question. If I want to make a way for people to pay for health in my game, how would I go about coding that? Would be like this?Code: ($purchace = 1000000) ==
Select question
Hi,First I would like to say that php is pretty new for me.. so please don't shoot me if this should be a stupid question!But I'm a little surpized due to following..I have a search script (very large
Problem with umlauts and UTF-8
Hello every1,I'm creating my own little CMS at the moment and got some problems with the charset. I decided to use UTF-8 so that I don't have to switch between charsets when using different