php - Extract JSON Array from data -


i requesting data website , expecting clean json array in return.

however getting instead:

<pre></pre>{"status":"success","result":1} 

which won't parse json_decode();.

how extract json array out of data can parse it?

note: not in control of code requesting data from.

try this

$output_array = array();  $badstr = '<pre></pre>{"status":"success","result":1}';  preg_match("/{.*}/", $badstr, $output_array); 

in $output_array[0] have json string.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -