I need to get the html code from the joomla internal link, and transfer the code to the module
My code default.php
<?php
defined( '_JEXEC' ) or die;
?>
<div class="container" id="expandAjaxReq-root" class="<?php echo $moduleclass_sfx; ?>">
<div class="row" id="expandAjaxReq-row-button">
<div class="col-md-12"><button class="btn" id="btnExpaneAjaxReq" type="button" onclick="btnExpaneAjaxReqClick();"><strong><?php echo $params->get('btntext') ; ?></strong><i class="fas fa-chevron-down" style="margin-left: 10px;"></i><br></button></div>
</div>
<div class="row" id="expandAjaxReq-row-content">
<div class="col-md-12" id="expandAjaxReq-col-content">
<div class="d-flex overflow-auto" id="expandAjaxReq-content"></div>
</div>
</div>
</div>
helper.php
<?php
defined( '_JEXEC' ) or die;
class modExpandAjaxReqHelper
{
public static function getRequestAjax() {
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_expandajaxreq');
$params = new JRegistry($module->params);
$url = $params->get('request_url');
$html = file_get_contents('http://127.0.0.1/'. $url.'&tmpl=component'));
return $html;
}
}
?>
expandAjaxReq.js
function btnExpaneAjaxReqClick() {
if (jQuery("#btnExpaneAjaxReq>i").hasClass( "fa-chevron-down" ))
{
jQuery("#btnExpaneAjaxReq>i").removeClass( "fa-chevron-down" );
jQuery("#btnExpaneAjaxReq>i").addClass( "fa-chevron-up" )
jQuery.ajax({
url: 'index.php?option=com_ajax&module=expandajaxreq&method=getRequest&format=raw',
type: 'POST',
success:function(responce){
jQuery("#expandAjaxReq-content").html(responce);
},
error:function(responce){
jQuery("#expandAjaxReq-content").html(responce.responseText);
}
});
}
else {
jQuery("#btnExpaneAjaxReq>i").removeClass( "fa-chevron-up" );
jQuery("#btnExpaneAjaxReq>i").addClass( "fa-chevron-down" )
jQuery("#expandAjaxReq-content").html("");
}
}
How to read the hpml code correctly $html = file_get_contents('http://127.0.0.1/'. $url.'&tmpl=component')); ? How to get the root link of my site - http(s)://127.0.0.1/ ? Thank you so much