diff options
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-x | include/oembed.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/include/oembed.php b/include/oembed.php index 6fc4c5371..04a40f6ee 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -1,4 +1,4 @@ -<?php +<?php /** @file */ function oembed_replacecb($matches){ // logger('oembedcb'); $embedurl=$matches[1]; @@ -29,7 +29,11 @@ function oembed_fetch_url($embedurl){ if (!in_array($ext, $noexts)){ // try oembed autodiscovery $redirects = 0; - $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*"); + + $result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true )); + if($result['success']) + $html_text = $result['body']; + if($html_text){ $dom = @DOMDocument::loadHTML($html_text); if ($dom){ @@ -47,10 +51,17 @@ function oembed_fetch_url($embedurl){ } } - if ($txt==false || $txt==""){ + if ($txt==false || $txt=="") { + $x = array('url' => $embedurl,'videowidth' => $a->videowidth); + call_hooks('oembed_probe',$x); + if(array_key_exists('embed',$x)) + $txt = $x['embed']; + // try oohembed service - $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; - $txt = fetch_url($ourl); +// $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; +// $result = z_fetch_url($ourl); +// if($result['success']) +// $txt = $result['body']; } $txt=trim($txt); |