$serch="/<li>(.*?)<\/li>/"; preg_match_all($serch,file_get_contents('./cn_name.html'),$r,PREG_SET_ORDER ); $result=[]; foreach($r as $k => $v){ //$v[1]=str_replace('(','',$v[1]); //$v[1]=str_replace(')','',$v[1]); array_push($result,$v[1]); } file_put_contents('./cn_name.json',json_encode($result));