Jump to content

Recommended Posts

Finding a working script to achieve this task has proven pointless. I have found several examples but have yet to find one that works.

 

I started using PHP several months ago and have been able to do alot of the content gathering by using snoopy but some features on myspace require you to be signed in. I do not want to spam, or even post anything to myspace. I am solely interested in gathering information (stats specifically) from Myspace Apps.

 

I have just begun to look at Curl and I certainly believe its capable of it but every script i find (as recently as February  2010) dont work or gives this error:

 

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/a1242578/public_html/myspace_login.php  on line 16

 

line 16 is:

 

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

 

php.net says this is redundant because Curl will follow all redirects unless directed otherwise but if i comment it out, i get no error but i get no output either.

 

PHP is NOT running in safe more. What else could cause this error? Is line 16 required or should it work without it?

 

Here is the script in its entirety, found on this site.

 

<?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='myspace_login.php' method='POST'>
        <input type='text' name='user' /><br />
        <input type='password' name='passwd' /><br />
        <input type='submit' value='submit' />
        </form>
        
        </form>
        </body>
        </html>";
}

?> 

Link to comment
https://forums.phpfreaks.com/topic/196172-phpcurl-myspace-login-script/
Share on other sites

I just tried it and it seams fine on my local machine, (are you sure its not in safe mode)

also check what open_basedir is set to

 

My text script

<?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);
        
	curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); 

        $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='' method='POST'>
        <input type='text' name='user' /><br />
        <input type='password' name='passwd' /><br />
        <input type='submit' value='submit' />
        </form>
        
        </form>
        </body>
        </html>";
}

?> 

 

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.