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

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -