[英]Sending an XML file contains gpg signature with PHP+cURL
我在<SIGNATURE>
標記中有一個xml文件和一個GPG簽名。
這是xml:
$xml = "<DATA>
....
<SIGNATURE>-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
-----END PGP SIGNATURE-----
</SIGNATURE>
</DATA>";
當我使用perl發送此xml時,響應正常,並且遠程主機接受簽名。
但是,如果我使用php和cURL發送該xml,則遠程服務器將關閉該簽名。
接下來的模塊在perl腳本中use URI (); use GnuPG qw( :algo ); use LWP::UserAgent (); use IO::Socket::SSL;
: use URI (); use GnuPG qw( :algo ); use LWP::UserAgent (); use IO::Socket::SSL;
use URI (); use GnuPG qw( :algo ); use LWP::UserAgent (); use IO::Socket::SSL;
接下來的cURL選項在php腳本中設置:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
我想卷曲有問題。可能缺少卷曲設置,但我不知道是哪個。 我已經嘗試了$xml
字符串的urlencode
和qoutemeta
php函數,但是沒有結果。
添加用戶代理選項。
curl_setopt($ ch,CURLOPT_USERAGENT,“ Mozilla / 5.0(Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1)Gecko / 2008070206 Firefox / 3.0.1”);
curl_setopt($ ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ ch,CURLOPT_URL,$ url);
curl_setopt($ ch,CURLOPT_POST,1);
curl_setopt($ ch,CURLOPT_POSTFIELDS,$ xml);
curl_setopt($ ch,CURLOPT_RETURNTRANSFER,1);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.