I have a problem with parsing a HTML page. There is a variable in javascript that I need to get it and put it into json format.
<script>
var variable1 = "foo";
var variable2 = "boo";
var multipleArray = [
{"var1":"1",
"var2": [{
"var21":"Extra Lge",
"var22":"45923090470",
"var23": {"key1":"value1",
"key2":"value"}
}],
...etc...
}]
</script>
Is there any easy way, how to get var multipleArray and all keys and values ? I used preg_match()
preg_match("'var multipleArray = [\{.*?\}]'", $source, $matches );
But it returns $matches
as empty array().
What i am doing wrong? My experence with reg.ex. is on level 0 :(
I'll be glad for any help :) Thank you so much :)