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
Table sorting
Hi,I'm trying to modify the following in order to make the output table sorted alphabetically according to $event_name but so far have not succeeded. Any pointers?Code: function display_all_events(){
Add 5 to a variable when a button is clicked, and re-run a for loop
So I'm making a feedback sort of section on a website with MySQL and PHP, I've gotten the script to do everything I want except for this. I want the script to only show 5 at a time (which i have
function to return url
Hi,Can you guys help me giving a function that takes all the contents in a particular field and returns text and url seperately...For instance,Go:here is the linkwww.google.comit takes all the
Email with Attachments in PHP
Hi Friends How to send email in PHP with attachment.I know simple mail can be sent with mail() function but i have no idea about email with attachment.
Count on multidimensional array
Hi, i got an array as below:Array( => Array ( [2009-12-08] => 1 ) [1] => Array ( [2009-12-07] => 1 ) [2]
Inserting Data into a MS Access DB using PHP.
As part of my uni course I am doing a placement at a company whom want me to create a client zone for their website.Basically, they want me to create the code to get data from a MS Access db and
Sorting JTable on more than just the values listed in the columns
I have a collection of objects that store (among other things) two integer values. I only want to display one of these values. The displayed value will dictate the sort order of the JTable.However, I
Big O & time complexity ???
can you help me how to calculate the Big O & time complexity for any algorithm and c++ program please?
Grouping and sorting results
Please help with this query.I have 2 tables in a database, countires and cities. states looks like thiscountriesid -----------country1 ------------uk2 ------------us3 ------------japancitiesid
Show message after entering data
Hello Colleagues I would like to display messages after entering the data example: " data were successfully " or " Error send data" in advance thanks.