我使用$_GET
方法将html存储在php变量中
这就是我所做的。
http://myurl.com?html=%3Cdiv%20class=%22invoice-logo%22%20style=%22float:left;margin-bottom:15px;%22%3E%3Cimg%20src=%22https://myurl/account/images/invoice_logo.gif%22%20title=%22New%20Covenant%20Software%22%3E%3C/div%3E%3Cdiv%20style=%22clear:both%22%3E%3C/div%3E%3Ch3%20class=%22invoiceNum%22%20style=%22padding:0px;font-size:25px;%22%3E%3Cstrong%3EInvoice#9368%3Cstrong%3E%3C/strong%3E%3C/strong%3E%3C/h3%3E%3Ctable%20class=%22widefat%22%20style=%22font-size:12px;margin-bottom:6px;width:48%;%22%3E%3Ctbody%3E%3Ctr%3E%3Ctd%20class=%22table_heading%22%20style=%22text-align:left;%22%3EBill%20To%3C/td%3E%3Ctd%20class=%22table_heading%22%20style=%22text-align:left;%22%3EContact%20Us%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22text-align:left;background-color:white;%22%20class=%22table_body%22%3ETravis%20Harris%3Cbr%3ENew%20Covenant%20Software%3Cbr%3E322%20Old%20Mill%20Rd%3Cbr%3ENewmanstown,%20PA%2017073%3C/td%3E%3Ctd%20style=%22text-align:left;background-color:white;%22%20class=%22table_body%22%3ENew%20Covenant%20Software%3Cbr%3E%3Cb%3E%28866%29%20213-6539%3C/b%3E%3Cbr%3E%3Ca%20rel=%22noreferrer%22%20onclick=%22window.open%28%27https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=billing@newcovsoft.com%27,%27Compose%20new%20message%27,%27width=640,height=480%27%29;return%20false%22%20title=%22[GMCP]%20Compose%20a%20new%20mail%20to%20billing@newcovsoft.com%22%20href=%22mailto:billing@newcovsoft.com%22%3Ebilling@newcovsoft.com%3C/a%3E%3Cbr%3E%3C/td%3E%3C/tr%3E%3C/tbody%3E%3C/table%3E%3Cdiv%20style=%22float:right;margin-bottom:5px;%22%3E%3Cstrong%3EDate:%20%3Cspan%20class=%22dateCreated%22%3E12/01/2011%3C/span%3E%20%3Cspan%20style=%22color:#C5D0DD;%22%3E%20|%20%3C/span%3E%20Due%20Date:%20%3Cspan%20class=%22dueDate%22%3E01/01/2012%3C/span%3E%3C/strong%3E%3C/div%3E%3Cdiv%20style=%22clear:both;%22%3E%3C/div%3E%3Cdiv%20id=%22table-invoice-result%22%3E%3Ctable%20class=%22widefat%22%3E%3Ctbody%3E%3Ctr%3E%3Ctd%3EQuantity%3C/td%3E%3Ctd%3EDescription%3C/td%3E%3Ctd%3ERate%3C/td%3E%3Ctd%3EAmount%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E8%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3EROSS%20Server%20Fees:%20TESTING3%20%28December%2016th%202011-January%2015th%202012%29%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E$79.99%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E$639.92%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E12%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3EROSS%20Server%20Fees:%20TESTING3%20%28December%2016th%202011-January%2015th%202012%29%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E$79.99%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E$959.88%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E10%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$799.90%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%20style=%22background-color:white;%22%3E1%3C/td%3E%3Ctd%20style=%22background-color:white;text-align:left;%22%3ECustomer%20Credit:%20Server%20Fee%20Credit%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3Ctd%20style=%22background-color:white;%22%3E%3Cfont%20color=%22RED%22%3E-$79.99%3Cfont%3E%3C/font%3E%3C/font%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%3ESales%20Tax%3C/td%3E%3Ctd%20class=%22salestax%22%3E$0.00%3C/td%3E%3Ctd%3E%3C/td%3E%3Ctd%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%3E%3Cstrong%3ETotal%3C/strong%3E%3C/td%3E%3Ctd%20class=%22total%22%20style=%22font-weight:bold;%22%3E$0.00%3C/td%3E%3Ctd%3E%3C/td%3E%3Ctd%3E%3C/td%3E%3C/tr%3E%3Ctr%3E%3Ctd%3E%3C/td%3E%3Ctd%20class=%22date_paid_status%22%20style=%22font-size:%2020pt;%20color:darkblue;%20font-weight:bold;%22%3EPAID%2012/01/2011%3C/td%3E%3Ctd%3E%3C/td%3E%3Ctd%3E%3C/td%3E%3C/tr%3E%3C/tbody%3E%3C/table%3E%3C/div%3E%3Cbr%3E%3Ci%3E*%20Paper%20Checks%20are%20not%20accepted.%20Any%20paper%20checks%20received%20will%20be%20converted%20into%20E-Checks%20and%20destroyed.%3C/i%3E
我的问题是如果我试图回应这个,我没有得到所有的结果。这就是我回应它的方式。
$html = <<<EOD
{$_GET['html']}
EOD;
echo $html;
这只是我回应时的结果:
<div class="invoice-logo" style="float:left;margin-bottom:15px;"><img src="https://myurl/account/images/invoice_logo.gif" title="Test Title"></div><div style="clear:both"></div><h3 class="invoiceNum" style="padding:0px;font-size:25px;"><strong>Invoice
正如您所看到的,它在代码<strong>Invoice
之后被切断
任何想法为什么会这样。任何帮助都将受到极大的赞赏和奖励!
谢谢!
答案 0 :(得分:4)
你做错了什么 HTML是程序代码的一部分,不应在服务器和客户端之间来回发送。
而不是这样,只应从客户端接收原始数据,然后在服务器端格式化,然后必须将结果HTML发送到客户端。
答案 1 :(得分:2)
请参阅http://www.boutell.com/newfaq/misc/urllength.html和Is there a limit to the length of a GET request?
使用curl
获取PHP中的URL内容(如果您尝试从标准网站获取HTML)或使用POST
(如果您'直接将HTML传递给PHP文件。)
答案 2 :(得分:2)
如果您需要将html放在GET请求中,请使用base64_encode()。提交后,您可以通过运行base64_decode($ _ GET ['html'])解码html。