0

I have tried by this way(according to the selected answer of "jerjer") but failed to load the content..

Load external site's content

render.php

<?php
    $url = 'http://apps.irs.gov/app/withholdingcalculator/index.jsp';
    $htm = file_get_contents($url);
    echo $htm;
?>

common.js

$(document).ready(function(){
    $('#divId').load('render.php');
});

index.html

<html>
<head>
    <title>Home</title>
    <link rel="stylesheet" href="css/style.css" type="text/css">
    <script src="js/jquery.js"></script>
    <script src="js/common.js"></script>
</head> 
<body>
    <div id="divId"></div>
</body>
</html>

Any help? Thanks in advance...

Community
  • 1
  • 1
Codegiant
  • 2,110
  • 1
  • 22
  • 31

1 Answers1

1

Use this code. Make sure you have curl extension installed.

 $url = 'http://apps.irs.gov/app/withholdingcalculator/index.jsp';
 $htm = getCurlData($url);
 echo $htm;

function getCurlData($url)
{
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     $contents = curl_exec($ch);
     curl_close($ch);
     return $contents;
}
Iqbal Malik
  • 602
  • 5
  • 13