4shared soap api based grabber with search by extension !

Started on the old forum in February 2013 · view the original in the archive · old links redirect here

37 replies · 9,938 views · started 13 years ago · 1 min read

TL;DR · summary of 37 replies
  • The fix for the 4shared API issue was found to be using the REST API, but no code approach or solution was provided.
  • Users reported issues with direct downloads due to changes in the API and encountered HTTP 403 Forbidden errors.
  • A user suggested adding a file ID parameter to display seconds left, but this did not solve the problem of getting the direct download link.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

19 participants
just_m3. Developer · 199 posts #1

You may modify this and get it work with any extension , this one is maked for music , and is requesting direct download link by soap client with login !

You need an account on 4shared .

Enjoy 🙂

Demo :

http://gowap.asia/4shared/

More info (search in page for "search" ) :

SOAP API - 4shared wiki

Added after 12 minutes:

Hmmm this is 100$ worth script 🙂

3 or 4 lines worth 100 bucks 🙂) lol .. ..

Yeah , i know ... for sale in market , this script "based on soap api" is for sale on web

i made one , easy task.

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Attachments: 4shared music.zip
darjo Newbie · 3 posts #2

Thanks brother...you rock !!

just_m3. Developer · 199 posts #3

vampiric wrote: How to edit this on search other files.

Follow

SOAP API - 4shared wiki (upper link)

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

just_m3. Developer · 199 posts #5

I got a private message question ,

why 4shared script? 'Fisierul nu este disponibil reincarca pagina !'

i think it's useful for all ->

That tells you that 4shared file doesn't exist , or isn't available , that is a protection act so your user will not be redirected to 4shared and see they'r error page 🙂 .

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

brentg Developer · 95 posts #8

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

Free Mobile Downloads: http://playwap.mobi

charith7788 Developer · 51 posts #9

The Fox wrote: 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.

Freddynic159 Junior · 43 posts #10

brentg wrote: 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:

charith7788 wrote: good job, its very important to 4shared mobile downloaders.

You're welcome bro... It is a pleasure for me to share! 🍻

charith7788 Developer · 51 posts #11

The Fox wrote: 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

Freddynic159 Junior · 43 posts #12

charith7788 wrote: 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"

if($page>1)
{ $ppage = $page-1;
echo "<a href=\"4shared.php?page=".$ppage."&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."&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:

if($page>1)
{$ppage = $page-1;
echo "<a href=\"4shared.php?query=".htmlspecialchars($_GET['query'])."&type=".$type."&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'])."&type=".$type."&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>";

}
pankajb Junior · 12 posts #13

Thanks for sharing such useful script.

just_m3. Developer · 199 posts #16

The Fox wrote: 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
######################
## 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]."    "; 

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

echo' <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' <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>";
}

?>

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Attachments: download.zip
belginfish Newbie · 1 posts #17

any idea why changing the code from

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

to

header("Location: ".htmlspecialchars($dlid));

doesn't work? It redirects to 4shared saying the url is invalid

something else Fellow · 2,296 posts #18

belginfish wrote: any idea why changing the code from

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

to

header("Location: ".htmlspecialchars($dlid));

doesn't work? It redirects to 4shared saying the url is invalid

Have you tried:

header("Location: ".$dlid);
kevk3v Senior · 332 posts #19

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

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

just_m3. Developer · 199 posts #20

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.

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close