我有以下代码,我试图在$ query变量中做一个正则表达式替换,我需要用“Bye”替换所有出现的“Hello”。这段代码有什么问题?
<?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";
}
?>