Created
April 3, 2015 09:36
-
-
Save iksi/d98080d2497594985b61 to your computer and use it in GitHub Desktop.
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
protected function filter($response, $arguments) | |
{ | |
$data = json_decode($response); | |
$dom = new \DOMDocument; | |
$dom->loadHTML($data->html); | |
$iframe = $dom->getElementsByTagName('iframe')->item(0); | |
if ($iframe === null) { | |
return $response; | |
} | |
$src = $iframe->getAttribute('src'); | |
$src .= (strpos($src, '?') ? '&' : '?') . http_build_query($arguments); | |
$iframe->setAttribute('src', $src); | |
$data->html = $dom->saveXML($iframe, LIBXML_NOEMPTYTAG); | |
return json_encode($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment