<?php
$data = wp_remote_get( 'https://www.tvasites.com/cmswebparts/insite3/api/exporttowordpress.aspx' );
$data = wp_remote_retrieve_body( $data );
$output = [];
if ( preg_match_all( '/{([^}]*)}/', $data, $matches ) ) {
foreach ( $matches[1] as $item ) {
$lines = preg_split( '/\\r\\n?|\\n/', $item, null, PREG_SPLIT_NO_EMPTY );
if ( is_array( $lines ) ) {
$lines = array_map( function ( $item ) {
$line = explode( ': ', $item );
return '"' . $line[0] . '": "' . trim( $line[1], "'," ) . '",';
}, $lines );
$output[] = json_decode( '{' . rtrim( join( '', $lines ), ',' ) . '}' );
}
}
}