Jump to content

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

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.