4shared soap api based grabber with search by extension !

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kampret
    replied
    nice work brother

    good job brother

    Leave a comment:


  • icedroplet1987
    replied
    Originally posted by just_m3. View Post
    I wroted this script as much easier to understand as i could ,
    as i posted before this require soap client installed on server side .

    This should be easy to read through even for a newbie.
    thats why serious users get irritated.. coz they (newbies) ask for even DOTS anyways, coding-talk always rocks

    n you too man @ just_m3

    Leave a comment:


  • gendhenk
    replied
    Originally posted by just_m3. View Post
    PHP Code:
    <?php
    ######################
    ## forged on gowap.ro#
    ######################

    require_once'config.php';
    require_once
    'functions.php';

    $formeruri='http://www.4shared.com/mp3/'.$_GET['id'].'/'.$_GET['mod'].'.html';

    # get direct download link
    $client = new SoapClient("http://api.4shared.com/servlet/services/DesktopApp?wsdl");

    $dlid = $client->getDirectLink(LOGIN,PASSWORD,$formeruri);
    $id = $client->decodeLink(LOGIN,PASSWORD,$formeruri);
    $info = $client->getFileInfo(LOGIN,PASSWORD,$id);

    $regx=array('|\[(.*?)]|i','|\((.*?)\)|i','|www(.*?)$|i');
         
    $nume_fisier=preg_replace($regx,'',utf8_format($info->name));

    /// check if 302 and switch $url to header location 
    /// otherwise use $dlid former url got from api
    $head = array_change_key_case(get_headers($dlid, TRUE));
    /// switch here
    if(!empty($head['location'])){$dlid=$head['location'];} 
    ## if the $url is file location we force to get 200 ok 
    ## the $url location from header must also return 200 ok
    $status=get_headers($dlid);

    echo 
    $status[0]."&nbsp;&nbsp;&nbsp;&nbsp;"; 

    if(
    $status[0]=="HTTP/1.1 200 OK") {

    echo
    '&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';

    }

    /*
    ## we use else statement if header is not 200 ok 
    ## this works if they modify the header other than 302 or 200
    ## it will work fine but you will not be able to stop the user 
    ## for beeing redirected if the file doesn't exist anymore .

    ## uncomment if you want to use it !

    else {
    echo'&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';
    }
    */

    ## comment this line if you want to use the upper one !
    else {
    echo
    "<h1>This file is not available !</h1>";
    }

    ?>
    thank this script work bro..

    Leave a comment:


  • just_m3.
    replied
    I wroted this script as much easier to understand as i could ,
    as i posted before this require soap client installed on server side .

    This should be easy to read through even for a newbie.

    Leave a comment:


  • kevk3v
    replied
    You could have skipped a dot lol header("Location: $dlid");

    Leave a comment:


  • something else
    replied
    Originally posted by belginfish View Post
    any idea why changing the code from

    Code:
    echo'&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';
    to

    Code:
    header("Location: ".htmlspecialchars($dlid));
    doesn't work? It redirects to 4shared saying the url is invalid
    Have you tried:
    PHP Code:
    header("Location: ".$dlid); 

    Leave a comment:


  • belginfish
    replied
    any idea why changing the code from

    Code:
    echo'&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';
    to

    Code:
    header("Location: ".htmlspecialchars($dlid));
    doesn't work? It redirects to 4shared saying the url is invalid

    Leave a comment:


  • just_m3.
    replied
    Originally posted by The Fox View Post
    I've noticed that the downloads do not work in some hostings and tell the truth I would not know why this happens because as you can see in the [DEMO] downloads work perfectly!


    PHP Code:
    <?php
    ######################
    ## forged on gowap.ro#
    ######################

    require_once'config.php';
    require_once
    'functions.php';

    $formeruri='http://www.4shared.com/mp3/'.$_GET['id'].'/'.$_GET['mod'].'.html';

    # get direct download link
    $client = new SoapClient("http://api.4shared.com/servlet/services/DesktopApp?wsdl");

    $dlid = $client->getDirectLink(LOGIN,PASSWORD,$formeruri);
    $id = $client->decodeLink(LOGIN,PASSWORD,$formeruri);
    $info = $client->getFileInfo(LOGIN,PASSWORD,$id);

    $regx=array('|\[(.*?)]|i','|\((.*?)\)|i','|www(.*?)$|i');
         
    $nume_fisier=preg_replace($regx,'',utf8_format($info->name));

    /// check if 302 and switch $url to header location 
    /// otherwise use $dlid former url got from api
    $head = array_change_key_case(get_headers($dlid, TRUE));
    /// switch here
    if(!empty($head['location'])){$dlid=$head['location'];} 
    ## if the $url is file location we force to get 200 ok 
    ## the $url location from header must also return 200 ok
    $status=get_headers($dlid);

    echo 
    $status[0]."&nbsp;&nbsp;&nbsp;&nbsp;"; 

    if(
    $status[0]=="HTTP/1.1 200 OK") {

    echo
    '&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';

    }

    /*
    ## we use else statement if header is not 200 ok 
    ## this works if they modify the header other than 302 or 200
    ## it will work fine but you will not be able to stop the user 
    ## for beeing redirected if the file doesn't exist anymore .

    ## uncomment if you want to use it !

    else {
    echo'&nbsp;<a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';
    }
    */

    ## comment this line if you want to use the upper one !
    else {
    echo
    "<h1>This file is not available !</h1>";
    }

    ?>
    Attached Files

    Leave a comment:


  • Freddynic159
    replied
    Originally posted by srexx View Post
    download error
    I've noticed that the downloads do not work in some hostings and tell the truth I would not know why this happens because as you can see in the [DEMO] downloads work perfectly!

    Leave a comment:


  • srexx
    replied
    download error

    Leave a comment:


  • pankajb
    replied
    Thanks for sharing such useful script.

    Leave a comment:


  • Freddynic159
    replied
    Originally posted by charith7788 View Post
    bro when i click the next button in the bottom of the search result page, it comes with 2nd page with type of mp3 as default, check it out
    To solve this problem just change this line in the file "4shared.php"

    PHP Code:
    if($page>1)
    { 
    $ppage = $page-1;
    echo 
    "<a href=\"4shared.php?page=".$ppage."&amp;query=".htmlspecialchars($_GET['query'])."\">« Prev</a> | ";
    }

    //if the number of files can't be divided by 10 (pages)
    //add 1 to show the rest of items available
    if ($toate % 10 !== 0) {$total=$total_pages+1;} 
    //if the number of files can be divided by 10 (pages)
    else{$total = $total_pages;}

    if(
    $page<$total)
    { 
    $addpage = $page+1;
    echo 
    "<a href=\"4shared.php?page=".$addpage."&amp;query=".htmlspecialchars($_GET['query'])."\">Next Â»</a>";
    }

    echo 
    "<form action=\"4shared.php\" method=\"get\">";
    echo 
    "<input type=\"hidden\" name=\"query\" value=\"".htmlspecialchars($_GET['query'])."\" size=\"2\"/>";
    echo 
    "<input type=\"text\" name=\"page\" value=\"".$page."\" size=\"2\"/>";
    echo 
    "<b>/".$total."</b> <input type=\"submit\" value=\"GO!\"/></form>";


    } 
    For this line:

    PHP Code:
    if($page>1)
    {
    $ppage = $page-1;
    echo 
    "<a href=\"4shared.php?query=".htmlspecialchars($_GET['query'])."&amp;type=".$type."&amp;page=".$ppage."\">« Prev</a> | ";
    }

    //if the number of files can't be divided by 10 (pages)
    //add 1 to show the rest of items available
    if ($toate % 10 !== 0) {$total=$total_pages+1;} 
    //if the number of files can be divided by 10 (pages)
    else{$total = $total_pages;}

    if(
    $page<$total)
    { 
    $addpage = $page+1;
    echo 
    "<a href=\"4shared.php?query=".htmlspecialchars($_GET['query'])."&amp;type=".$type."&amp;page=".$addpage."\">Next Â»</a>";
    }

    echo 
    "<form action=\"4shared.php\" method=\"get\">";
    echo 
    "<input type=\"hidden\" name=\"query\" value=\"".htmlspecialchars($_GET['query'])."\" size=\"2\"/>";
    echo 
    "<input type=\"text\" name=\"page\" value=\"".$page."\" size=\"2\"/>";
    echo 
    "<b>/".$total."</b> <input type=\"submit\" value=\"GO!\"/></form>";


    } 

    Leave a comment:


  • charith7788
    replied
    Originally posted by The Fox View Post
    Hi all! I made some changes to work with any extension so I want to share with all of you!

    [DEMO]: http://multiwap.zz.mu/4shared.php

    [NOTE]: Please enter the details of your 4shared account in the file: "config.php" for this to work!
    bro when i click the next button in the bottom of the search result page, it comes with 2nd page with type of mp3 as default, check it out

    Leave a comment:


  • Freddynic159
    replied
    Originally posted by brentg View Post
    Great stuff, working fine my side.

    PS. How can we remove the default searches on the 4shared.php so that it only shows the search field.

    Thanks
    Did not quite understand, could you explain better?

    Added after 3 minutes:

    Originally posted by charith7788 View Post
    good job, its very important to 4shared mobile downloaders.
    You're welcome bro... It is a pleasure for me to share!
    Last edited by Freddynic159; 30.03.13, 15:38.

    Leave a comment:


  • charith7788
    replied
    Originally posted by The Fox View Post
    Hi all! I made some changes to work with any extension so I want to share with all of you!

    [DEMO]: http://multiwap.zz.mu/4shared.php

    [NOTE]: Please enter the details of your 4shared account in the file: "config.php" for this to work!
    good job, its very important to 4shared mobile downloaders.

    Leave a comment:

Working...
X