Page 1 of 1

myspace status update with curl

Posted: Tue May 18, 2010 10:48 pm
by srihari3d
Hi

Re: myspace status update with curl

Posted: Tue May 18, 2010 11:05 pm
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

Re: myspace status update with curl

Posted: Tue May 18, 2010 11:07 pm
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); */
	}