Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.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 当我搜索该项时,它显示parse error_Php_Xml_Simplexml - Fatal编程技术网

Php 当我搜索该项时,它显示parse error

Php 当我搜索该项时,它显示parse error,php,xml,simplexml,Php,Xml,Simplexml,当我搜索该项时,它显示解析错误并给出警告。如何删除此警告。 当我搜索该项时,它显示解析错误并给出警告。如何删除此警告 如何消除此警告和错误 Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: http://svcs.sandbox.ebay.com/services/search/FindingService/v1

当我搜索该项时,它显示解析错误并给出警告。如何删除此警告。 当我搜索该项时,它显示解析错误并给出警告。如何删除此警告

如何消除此警告和错误

Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: http://svcs.sandbox.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&amp;SERVICE-VERSION=1.8.0&amp;GLOBAL-ID=EBAY-US&amp;SECURITY-APPNAME=arifliaq-093e-43f2-a6ac-1e8ce8da2625&amp;keywords=110114826574&amp;paginationInput.entriesPerPage=1&amp;outputSelector=SellerInfo:1: 

parser error : Opening and ending tag mismatch: link line 1 and head in C:\wamp\www\PHP_PlaceOfferGS_TradingShopping\Browsing.php on line 39"
警告:simplexml_load_file()[]:http://svcs.sandbox.ebay.com/services/search/FindingService/v1?OPERATION-名称=FindItemAdvanced&;服务版本=1.8.0&;GLOBAL-ID=EBAY-US&;SECURITY-APPNAME=arifliaq-093e-43f2-a6ac-1e8ce8da2625&;关键词=110114826574&;分页输入。entriespage=1&;outputSelector=SellerInfo:1:
解析器错误:开始和结束标记不匹配:链接第1行和C:\wamp\www\PHP\u PlaceOfferGS\u TradingShopping\Browsing.PHP中的头,第39行“
代码:

<?php
require_once('./sessionHeader.php');
require_once('./SingleItem.php');
require_once('./keys.php');
error_reporting(E_ALL);          // useful to see all notices in development
?>

<HTML>
<HEAD>
<TITLE>Browsing on eBay</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="js/JQuery.js"></script>
<script type="text/javascript" src="js/ShowDetails.js"></script>
</HEAD>

<BODY>
<H1>Browsing on eBay</H1>
<br>

<?php
global $shoppingURL,$appID,$eBayVersion,$findingURL,$compatabilityLevel, $findingVer;    // these come from keys.php
//need to urlencode the user-input keyword for the Finding API
$safeQuery = urlencode($_POST['QueryString']);
//construct the URL; we want to get only one returned item to keep things simple so   set entriesPerPage to 1
// (by default, only one page is returned)
$apicall  = "$findingURL?OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=$findingVer"
        . "&GLOBAL-ID=EBAY-US"
        . "&SECURITY-APPNAME=$appID"
        . "&keywords=$safeQuery"
        . "&paginationInput.entriesPerPage=1"
        . "&outputSelector=SellerInfo";


if ($debug) {
 print"<p>$apicall</p>"; //see what call is if we're debugging-$debug comes from keys.php
 }

 // Load the call and capture the document returned by the Finding API
 $resp = simplexml_load_file($apicall);

// Check to see if the response was loaded, else print an error
if ($resp) {
$results = '';
if ($resp->paginationOutput->totalEntries == 0) {
    $results .= "<BR>Sorry, there were no results found\n";
} else {
 $results .= "<DIV ALIGN=CENTER> \n";
 // If the response was loaded, parse it and build links
 // To keep things simple, we're showing only the first returned item;
 foreach($resp->searchResult->item as $item) {
 $browseItem = new SingleItem($resp->searchResult->item->itemId);
 $results .= $browseItem->getBrowseItemAsHTML_Table();
 $results .= "<form name=\"BidOrBuyIt\" method=\"post\" action=\"./Login.php\" >\n";
 $results .= "<INPUT TYPE=\"submit\" NAME=\"BidOrBuyIt\" VALUE=\"Bid or Buy It!\"> </form>\n";
 $_SESSION['ItemID'] = (string)$browseItem->resp->Item->ItemID;  // cast to string to keep in $_SESSION
 } // for each
 $results .= "</DIV> \n";
}
} else {
$results = "<BR>Sorry, did not receive a search result\n";
} // if $resp
print $results;
?>
</BODY>
</HTML>
![warning][1]

在易趣上浏览
在易趣上浏览

搜索结果->项目作为$item){ $browseItem=newsingleitem($resp->searchResult->item->itemId); $results.=$browseItem->getBrowseItemAsHTML_Table(); $results.=“\n”; $results.=“\n”; $\u会话['ItemID']=(字符串)$browseItem->resp->Item->Item->ItemID;//转换为字符串以保留在$\u会话中 }//每个 $results.=“\n”; } }否则{ $results=“
对不起,没有收到搜索结果\n”; }//如果$resp 打印$results; ?> ![警告][1]
编辑文件中的


。当您不关闭标签时,通常会出现此问题。

问题不在您的代码中,而在您从易趣url获取的XML中。对此您无能为力,只能联系易趣(不知何故)并要求他们创建格式良好的XML

隐藏它最简单(但也是最糟糕)的方法是使用@suppression方法

$resp = @simplexml_load_file($apicall);

我尝试了此错误,但仍然存在错误。如何删除此错误?$resp=simplexml\u load\u文件($apicall);上述行的错误我尝试了此错误,但仍然存在上述文件中的错误$resp=simplexml\u load\u文件($apicall);上面一行的错误如何删除此错误这不是最佳解决方案请帮助删除此错误我尝试此方法,警告丢失且无项目搜索这不是最佳解决方案给出另一个建议这是您所问问题的解决方案(“如何删除此警告和错误?”)。它隐藏了错误。您的代码中还有许多其他逻辑问题需要解决,我甚至可以尝试为您提供进一步的帮助,说明它为什么不执行您想要的操作。另一种将url传递到simplexml_load_fileplz的方法有助于删除此错误