im making something and this code isnt working
<script src='jq.js'></script>
<script>
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
);
}
nick = getURLParameter('kagNick')
</script>
<?php
$url = "https://api.kag2d.com/player/"+nick+"/status";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
?>
<script>
status = $result.split("\n")
if(status[4].indexOf("true,") != -1)
document.write("gold player")
</script>
What is wrong with the code? What I´m trying to do: -mazeygg.com/penis?kagNick=Mazey return ´gold player´ in the first js/jq part: make the /penis.html*?kagNick=Nickname* (nickname = mazey, for example) in the second part, php: connect to the website in the third part, js again: split the website and print something (Check http://api.kag2d.com/player/mazey/status)
I chose this because I did not find a proper way to do the php part in JS (I code js, not php), if you know how: it´s really appreciated! If you do not: Help me fixing this code so I can move on.
Thanks, in advance
foobar
, or some equivalent, but each to their own!