Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php进程xml读取文件_Php_Xml_File Io - Fatal编程技术网

php进程xml读取文件

php进程xml读取文件,php,xml,file-io,Php,Xml,File Io,在这里阅读,以便更好地使用readfile获取xml内容,因为它是最快的 我想从这里获取和处理内容 是的 然后,如果结果包含单词no,我将继续 像 回声在我的网站内容的xml文件。例如:ip是2013-10-07 13:19:05 2 不需要回显(不需要向访问者显示其ip地址在垃圾邮件列表中或否)使用文件获取内容和==错误 试试这个 if( strpos(file_get_contents("http://api.stopforumspam.org/api?ip=". urlencode(get

在这里阅读,以便更好地使用
readfile
获取xml内容,因为它是最快的

我想从这里获取和处理内容

是的

然后,如果结果包含单词
no
,我将继续

回声在我的网站内容的xml文件。例如:ip是2013-10-07 13:19:05 2


不需要回显(不需要向访问者显示其ip地址在垃圾邮件列表中或否)

使用
文件获取内容
==错误

试试这个

if( strpos(file_get_contents("http://api.stopforumspam.org/api?ip=". urlencode(get_ip_address()) ),'no') !== false ){
echo ' continue<br>';
}
if(strpos(文件获取内容)http://api.stopforumspam.org/api?ip=“.urlencode(get_ip_address()),'no')!==false){
回显“继续
”; }
您应该使用文件获取内容

$data = file_get_contents("http://www.stopforumspam.com/api?ip=91.186.18.61");
$chk = strpos($data, 'yes');
if($chk === false)
{
    echo ' continue<br>';
}
$data=文件获取内容(“http://www.stopforumspam.com/api?ip=91.186.18.61");
$chk=strpos($data,'yes');
如果($chk==false)
{
回显“继续
”; }

我已经检查了代码是否正常工作

条件有效。但我看到的好像是echo
ip no 0
。不想看到。条件
if…
就好像echo
ip no 0
。在我的情况下,问题是我在网站上看到了文件的内容。此
$data=file\u get\u内容(“http://www.stopforumspam.com/api?ip=91.186.18.61");好像回显内容
strpos
从不返回
true
。它将返回
false
子字符串的位置
@SKRocks我刚刚编辑了答案。这是我从问题中复制的一个打字错误。谢谢
readfile( "http://api.stopforumspam.org/api?ip=91.186.18.61" );
if( strpos(file_get_contents("http://api.stopforumspam.org/api?ip=". urlencode(get_ip_address()) ),'no') !== false ){
echo ' continue<br>';
}
$data = file_get_contents("http://www.stopforumspam.com/api?ip=91.186.18.61");
$chk = strpos($data, 'yes');
if($chk === false)
{
    echo ' continue<br>';
}