php - substr_replace all occurences inside big string -
i have following code, trying regular expression replace inside $query variable, , need replace occurences of "hello" "bye". wrong code?
<?php ini_set("default_socket_timeout", 116000); $curl_handle=curl_init(); curl_setopt($curl_handle, curlopt_url,'http://www.mysite.com.br/index.php?option=com_xxxx&format=xml'); curl_setopt($curl_handle, curlopt_connecttimeout, 2); curl_setopt($curl_handle, curlopt_returntransfer, 1); curl_setopt($curl_handle, curlopt_useragent, 'your application name'); $query = curl_exec($curl_handle); curl_close($curl_handle); if (strlen($query) > 95000){ echo "ok"; substr_replace ($query ("hello","bye",0)); file_put_contents('/home/myuser/mysite.com/xml/file.xml',$query); } else { echo "error"; } ?>
str_replace command looking for;
$query = str_replace ("hello","bye",$query);
Comments
Post a Comment