Created
October 6, 2019 11:03
-
-
Save Shaked/c7620056a28b088996dd91d2fcb628bf to your computer and use it in GitHub Desktop.
SSRF ideas?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = $_GET['url']; | |
$xml = @file_get_contents($url); | |
$ret = []; | |
if ($xml) { | |
$doc = new DOMDocument(); | |
libxml_use_internal_errors(true); | |
if ($doc->loadHTML($xml)) { | |
$title = $doc->getElementsByTagName('title'); | |
foreach ($title as $key => $value) { | |
$ret['title'] = $value->nodeValue; | |
} | |
$meta = $doc->getElementsByTagName('meta'); | |
foreach ($meta as $key => $value) { | |
$property = $value->getAttribute('property'); | |
if ($property == 'og:image') { | |
$ret['image'] = $value->getAttribute('content'); | |
break; | |
} | |
} | |
} | |
} else { | |
$ret['error'] = "could not parse url $url"; | |
} | |
echo json_encode($ret); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment