[英]How to avoid $_GET browser blocking because of XSS?
我正在使用ebay api。 試圖創建我的“本地”xml,因為它不允許我因為XSS而從遠程網站讀取它。
如果我在file_get_contents()中將完整的url寫入ebay api,一切正常,但是如果我嘗試通過$ _GET操作變量,它會停止工作,因為瀏覽器不允許它。 任何想法我怎么能避免這個? 這就是我在螢火蟲中得到的
XML解析錯誤:語法錯誤位置:moz-nullprincipal:{e9af9927-2754-4959-9d8b-a375737fba40}
這是代碼
<?php
header("Content-type: text/xml; charset=utf-8");
$a= $_GET["storename"];
$b= $_GET["catnumber"];
echo file_get_contents('http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsIneBayStores&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=APPID&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&storeName='. $a . '&outputSelector=categoryId='. $b);
?>
找到了解決方案..我不得不在$ _GET上使用urlencode
像這樣
urlencode($_GET["storename"]);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.