Jump to content

How do you share content to myspace/scribd in php


ipn_iyer

Recommended Posts

Hi fellas,

 

I would like to know how can you share content to myspace/scribd in php.

Is there any api for this.

I tried searching but found an incomplete code which doesn't work. I knwo that it is posssible using php curl

following is the incomplete code

 

For login:

<?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>";

}

 

?>

 

 

For posting status:

 

<?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();

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.