myspace status update with curl

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
srihari3d
Forum Newbie
Posts: 2
Joined: Tue May 18, 2010 10:41 pm

myspace status update with curl

Post by srihari3d »

Hi
Last edited by srihari3d on Mon May 24, 2010 2:13 am, edited 1 time in total.
User avatar
zeus1
Forum Newbie
Posts: 22
Joined: Tue May 18, 2010 10:45 pm
Location: /Under/The/AppleTree.png

Re: myspace status update with curl

Post by zeus1 »

It is impossible to trouble shoot without your code or the error you are getting. Please post all pertinent information.

Best Regards,
ZEUS
srihari3d
Forum Newbie
Posts: 2
Joined: Tue May 18, 2010 10:41 pm

Re: myspace status update with curl

Post by srihari3d »

Code: Select all

public function setStatus($stat) {
	
		if(strlen($stat) < 1)
			return false; 
		$username="srihari3d@gmail.com";
		$password="17021981";
		$status="poreeeeee";
		/*Set the host information for the curl session */
		$url = "https://secure.myspace.com/index.cfm?fuseaction=login.process";
		//$url="http://profileedit.myspace.com/index.cfm?fuseaction=profile.interests&MyToken=a0ef3ff6-5b8c-4d7b-9fdb-38c2e5df01f5";
		$post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=".$username."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=".$password;
		$ch1 = curl_init();
		//echo "dgd";
		
        curl_setopt($ch1, CURLOPT_URL, $url);
		curl_setopt($ch1, CURLOPT_POSTFIELDS,$post_data);
		curl_setopt($ch1, CURLOPT_POST, 1);
		curl_setopt($ch1, CURLOPT_HEADER, 0);
		curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($ch1, CURLOPT_COOKIEJAR, "my_cookies.txt");
		curl_setopt($ch1, CURLOPT_COOKIEFILE, "my_cookies.txt");
		curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch1, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12");
		curl_exec($ch1);
		curl_setopt($ch1, CURLOPT_POST, 0);
		curl_setopt($ch1, CURLOPT_URL, 'http://opensocial.myspace.com/roa/09/statusmood/myspace.com.person.478501013/@self?statuscode="pore"');
		$page = curl_exec($ch1);
		curl_setopt($ch1, CURLOPT_POST, 1);
		//preg_match("/input type=\"hidden\" name=\"post_form_id\" value=\"(.*?)\"/", $page, $form_id);
		//preg_match("/form action=\"(.*?)\"/", $page, $form_num);
		curl_setopt($ch1, CURLOPT_POSTFIELDS, 'post_form_id=' . $form_id[1] . '&status=' . urlencode($status) . '&update=' . urlencode("Update status"));
		curl_setopt($ch1, CURLOPT_URL, 'http://opensocial.myspace.com/roa/09/statusmood/myspace.com.person.478501013/@self?statuscode="pore"' . $form_num[1]);
		$result=curl_exec($ch1);
		print_r($result);
		curl_close($ch1);
		/*
        curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch1, CURLOPT_AUTOREFERER, 1);
        curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
		curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch1, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) ");
        curl_setopt($ch1, CURLOPT_COOKIEJAR, "cookie.txt");
        curl_setopt($ch1, CURLOPT_POST, 1);
        curl_setopt($ch1, CURLOPT_POSTFIELDS,$post_data);
		/* Execute and get the http code to see if it was succesfull or not*/
		/*$result = curl_exec($ch1);	
		print_r($result);
		curl_close($ch1); */
	}
Last edited by Benjamin on Wed May 19, 2010 4:20 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
Post Reply