Wαlrυѕ
Registered Member
- Sep 4, 2017
- 58
- 29
To use the script, install it on a server or use a program like:
https://www.apachefriends.org/index.html
http://www.wampserver.com/en/
This is what it should look like:
Here is the code! Download it and save it as ads.php!
https://www.apachefriends.org/index.html
http://www.wampserver.com/en/
This is what it should look like:
Here is the code! Download it and save it as ads.php!
PHP:
<html>
<head>
<script async="async" src="https://www.google.com/adsense/search/ads.js"></script>
<!-- other head elements from your page -->
<script type="text/javascript" charset="utf-8">
(function(g,o){g[o]=g[o]||function(){(g[o]['q']=g[o]['q']||[]).push(
arguments)},g[o]['t']=1*new Date})(window,'_googCsa');
</script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
var pageOptions = {
"pubId": "pub-9616389000213823", // Make sure this the correct client ID!
"query": "<?php
if (!isset($_POST['keyword']) || empty($_POST['keyword'])) {
echo "hotel";
}else {
echo $_POST["keyword"];
}
?>",
"adPage": <?php
if (!isset($_POST['page']) || empty($_POST['page'])) {
echo "50";
}else {
echo $_POST["page"];
}
?>,
"number": 25,
};
var adblock1 = {
"container": "afscontainer1",
"width": "700",
"number": 25
};
var adblock2 = {
"container": "afscontainer2",
"width": "700",
"number": 25
};
var adblock3 = {
"container": "afscontainer3",
"width": "700",
"number": 25
};
_googCsa('ads', pageOptions, adblock1, adblock2, adblock3);
</script>
<form action="" method="post">
Keyword: <input type="text" name="keyword" value="hotel"><br>
Page: <input type="text" name="page" value="50"><br>
<input type="submit">
</form>
<div id='afscontainer1'>Ads will load here...</div>
</body>
</html>