Skip to content

Instantly share code, notes, and snippets.

@harran55
Created September 21, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harran55/ce33f23ed6e9d79b1ac203f2b70ad8e7 to your computer and use it in GitHub Desktop.
Save harran55/ce33f23ed6e9d79b1ac203f2b70ad8e7 to your computer and use it in GitHub Desktop.
inst2
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
function file_get_contents_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
if (!isset($_GET["url"])){
?>
<form>
<input placeholder="ضع الرابط هنا https://www.instagram.com/p/BZJNeBDBmwe/" name="url" />
<input type="submit" value="تحميل">
</form>
<?php
die();
}
$html = file_get_contents_curl($_GET["url"]);
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($html);
$metas = $doc->getElementsByTagName('meta');
for ($i = 0; $i < $metas->length; $i++)
{
$meta = $metas->item($i);
$src = $meta->getAttribute('content');
if (strpos($src, 'cdninstagram') !== false) {
$src=str_replace("http:", "https:", $src);
echo "
<embed src=\"$src\">
<br/>
رابط مباشر للملف
<br/>
<input name=\"textfield\" type=\"text\" value=\"$src\"><a class=\"download\" download href='$src'>تحميل الملف</a><br>
<br/>
";
}
@xlmnxp
Copy link

xlmnxp commented Sep 21, 2017

ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
function file_get_contents_curl($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
if (!isset($_GET["url"])){
    ?>

<form>
<input placeholder="ضع الرابط هنا https://www.instagram.com/p/BZJNeBDBmwe/" name="url" />
<input type="submit" value="تحميل">
</form>

<?php
die();
}
$html = file_get_contents_curl($_GET["url"]);
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($html);
$metas = $doc->getElementsByTagName('meta');
for ($i = 0; $i < $metas->length; $i++)
{
    $meta = $metas->item($i);
       $src = $meta->getAttribute('content');
if (strpos($src, 'og:video:secure_url') || strpos($src, 'og:image')) {
$src=str_replace("http:", "https:", $src);
echo "
<embed src=\"$src\">
<br/>
رابط مباشر للملف
<br/>
<input name=\"textfield\" type=\"text\" value=\"$src\"><a class=\"download\" download href='$src'>تحميل الملف</a><br>
<br/>
";
}

@harran55
Copy link
Author

die(); } $html = file_get_contents_curl($_GET["url"]); //parsing begins here: $doc = new DOMDocument(); @$doc->loadHTML($html); $metas = $doc->getElementsByTagName('meta'); for ($i = 0; $i < $metas->length; $i++) { $meta = $metas->item($i); $src = $meta->getAttribute('property'); if ($src == 'og:video:secure_url') || ($src == 'og:image') { $src=str_replace("http:", "https:", $src); echo " <embed src=\"$src\"> <br/> رابط مباشر للملف <br/> <input name=\"textfield\" type=\"text\" value=\"$src\"><a class=\"download\" download href='$src'>تحميل الملف</a><br> <br/> "; } }

@xlmnxp
Copy link

xlmnxp commented Sep 21, 2017

ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
function file_get_contents_curl($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
if (!isset($_GET["url"])){
    ?>

<form>
<input placeholder="ضع الرابط هنا https://www.instagram.com/p/BZJNeBDBmwe/" name="url" />
<input type="submit" value="تحميل">
</form>

<?php
die();
}
$html = file_get_contents_curl($_GET["url"]);
//parsing begins here:
$doc = new DOMDocument();
@$doc->loadHTML($html);
$metas = $doc->getElementsByTagName('meta');

for ($i = 0; $i < $metas->length; $i++)
{
    $meta = $metas->item($i);
    $src = $meta->getAttribute('property');
    if ($src == 'og:video:secure_url') || ($src  == 'og:image')) {
       $link = $meta->getAttribute('content');
       $link = str_replace("http:", "https:", $link);
       echo "<embed src=\"$link\"><br/>رابط مباشر للملف<br/>
       <input name=\"textfield\" type=\"text\" value=\"$link\"><a class=\"download\" download href='$link'>تحميل الملف</a><br><br/>";
    }
}

@harran55
Copy link
Author

if (strpos($src, 'og:video:secure_url') !== false || strpos($src, 'og:image') !== false) {
$link = $meta->getAttribute('content');
$link = str_replace("http:", "https:", $link);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment