I make a curl Request to get some Javascript Code back. When i execute the php in terminal, i get the Javascript code. But when i try it with a browser the javascript code is not shown.
I tried to echo it with json_encode. But i only get a false back. I also tried here doc. but nothing seems to work.
Maybe because the javascript code i get back starts like this:
!function(n,t,d){function e(n,t){
How can i echo this javascript code for browser. In terminal it works fine.
<?php
function getUrlCurl($url) {
$curl_handle = curl_init();
curl_setopt ($curl_handle, CURLOPT_URL, $url);
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
$buffer = curl_exec($curl_handle);
$info = curl_getinfo($curl_handle);
curl_close($curl_handle);
return $buffer;
}
$response = getUrlCurl(myUrl);
?>
<html>
<head>
<script>
<?php echo json_encode($response); ?>
</script>
<body>
</body>
</html>