find('head meta[property^=og:]') as $tag) { $key = substr($tag->property, 3); if ($key == 'title' || $key == 'description' || $key == 'url') $response[$key] = $tag->content; } if ($prog = $dom->getElementById('prog-content')) { //if ($video = $prog->getElementById('prog-video')) { // $response['media'] = $video->outertext; //} else if ($carousel = $prog->find('.owl-carousel', 0)) { // //$images = array(); // //foreach ($carousel->find('div[style^=background:]') as $img) { // // check(preg_match('/^background:\s*url\(\'(.*?)\'\).*$/', $img->style, $m)); // // $images[] = $m[1]; // //} // $response['media'] = $carousel->outertext; //} $response['properties'] = array(); foreach ($prog->find('.programmering_info_detail li') as $tag) { $response['properties'][] = array( 'name' => preg_replace('/:\s+$/', '', $tag->children(0)->plaintext), 'description' => $tag->children(1)->innertext, ); } } header('Content-Type: application/json; charset=utf-8'); echo json_encode($response, JSON_UNESCAPED_SLASHES); ?>