", $scoobj); //var_dump($porciones); /*$doc = new DOMDocument(); $doc->loadHtml($scoobj); $body = $doc->getElementsByTagName('body'); $body->append($apistring); echo $doc->saveHTML();*/ $apistring = ''; $apistring .= ''; $apistring .= ''; $apistring .= ''; $apistring .= ''; $dom = new DOMDocument(); libxml_use_internal_errors(true); $context = stream_context_create(array( "ssl"=>array( 'verify_peer' => false, 'verify_peer_name' => false ) )); function get_file_path_from_url( $file_url ){ return realpath($_SERVER['DOCUMENT_ROOT'] . parse_url( $file_url, PHP_URL_PATH )); } libxml_set_streams_context($context); $dom->loadHTMLFile(get_file_path_from_url($scourl)); //get the element you want to append to $descBox = $dom->getElementsByTagName('body')[0]; //create the fragment $fragment = $dom->createDocumentFragment(); //add content to fragment $fragment->appendXML($apistring); //actually append the element //$descBox->appendChild($fragment); $origH3 = $dom->getElementsByTagName('head')[0]; $origH3->appendChild($fragment); echo $dom->saveHTML(); ?>