francisco 4 years ago

To solve the Same-Origin Policy problem, you could build a simple PHP page - on a service like Heroku, InfinityFree.net or 000WebHost - with the following code:

<?php
// Page get.php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");

$token = $_GET['token'];
$page = $_GET['page'];
echo file_get_contents("https://wapka.org/$token/$page");
?>

So on your Wapka site you could use the following code:

<div id="content"></div>
<script>$.ajax({
   url:'https://phpsite.com/get.php?toke=:VAR(token);&page=dashboard',
   type:'GET',
   success: function(data){
       $('#content').html($(data).find('#collapseSites').html());
   }
});
</script>
comment
francisco 4 years ago
The code got messed up, thanks Wapka 🙄
reply