construct_info_retrieval_error( $request, $response ); } else { $doc = new DOMDocument(); @$doc->loadHTML( $response['body'] ); $metas = $doc->getElementsByTagName( 'meta' ); for ( $i = 0; $i < $metas->length; $i++ ) { $meta = $metas->item( $i ); if ( $meta->getAttribute( 'property' ) == 'og:image' ) { $og_image = $meta->getAttribute( 'content' ); parse_str( parse_url( $og_image, PHP_URL_QUERY ), $image_array ); $result = $image_array['pic']; break; } } } return $result; } // Test cases public static function get_test_cases() { return array( array( 'markup' => '', 'expected' => 'http://cache02.stormap.sapo.pt/vidstore14/thumbnais/e9/08/37/7038489_l5VMt.jpg', 'expected_hash' => 'd8a74c3d4e054263a37abe9ceed782fd', 'name' => __( 'iFrame Embed', 'video-thumbnails' ) ), ); } } ?>