route oembed through z_fetch_url

This commit is contained in:
friendica 2013-02-25 20:13:30 -08:00
parent c45a8e2763
commit 9430117204

View File

@ -29,7 +29,11 @@ function oembed_fetch_url($embedurl){
if (!in_array($ext, $noexts)){ if (!in_array($ext, $noexts)){
// try oembed autodiscovery // try oembed autodiscovery
$redirects = 0; $redirects = 0;
$html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
$result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*"));
if($result['success'])
$html_text = $result['body'];
if($html_text){ if($html_text){
$dom = @DOMDocument::loadHTML($html_text); $dom = @DOMDocument::loadHTML($html_text);
if ($dom){ if ($dom){
@ -50,7 +54,9 @@ function oembed_fetch_url($embedurl){
if ($txt==false || $txt==""){ if ($txt==false || $txt==""){
// try oohembed service // try oohembed service
$ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth;
$txt = fetch_url($ourl); $result = z_fetch_url($ourl);
if($result['success'])
$txt = $result['body'];
} }
$txt=trim($txt); $txt=trim($txt);