2010-09-15 287 views
0

我正在使用curl從Emailvision向API發送xml請求。最近我遇到了一些請求導致「500內部服務器錯誤」的問題,而其他請求卻沒有發生任何錯誤。在PHP中捲曲的問題?

verbose的輸出粘貼在下面,有人可以幫我解釋可能導致錯誤的原因。

 
* About to connect() to api.notificationmessaging.com port 443 
* Trying 81.92.116.8... * connected 
* Connected to api.notificationmessaging.com (81.92.116.8) port 443 
* successfully set certificate verify locations: 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using RC4-MD5 
* Server certificate: 
*  subject: /C=FR/ST=Hauts de Seine/L=Clichy/O=Emailvision/OU=Provided by TBS INTERNET http://www.tbs-certificats.com//CN=*.notificationmessaging.com 
*  start date: 2008-09-20 09:09:15 GMT 
*  expire date: 2010-09-20 09:09:15 GMT 
*  issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected] 
* SSL certificate verify ok. 
POST /NMSXML HTTP/1.1 
Host: api.notificationmessaging.com 
Accept: */* 
Content-Length: 2177 
Content-Type: application/x-www-form-urlencoded 
Expect: 100-continue 

HTTP/1.1 100 Continue 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0 2177 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 HTTP/1.1 200 OK 
Date: Wed, 15 Sep 2010 05:15:53 GMT 
X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5 
Content-Type: application/xml;charset=utf-8 
Content-Length: 82 
Connection: close 
100 2259 0 82 100 2177 969 25745 --:--:-- --:--:-- --:--:-- 80629* Closing connection #0 

* About to connect() to api.notificationmessaging.com port 443 
* Trying 81.92.116.8... * connected 
* Connected to api.notificationmessaging.com (81.92.116.8) port 443 
* successfully set certificate verify locations: 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using RC4-MD5 
* Server certificate: 
*  subject: /C=FR/ST=Hauts de Seine/L=Clichy/O=Emailvision/OU=Provided by TBS INTERNET http://www.tbs-certificats.com//CN=*.notificationmessaging.com 
*  start date: 2008-09-20 09:09:15 GMT 
*  expire date: 2010-09-20 09:09:15 GMT 
*  issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected] 
* SSL certificate verify ok. 
POST /NMSXML HTTP/1.1 
Host: api.notificationmessaging.com 
Accept: */* 
Content-Length: 21942 
Content-Type: application/x-www-form-urlencoded 
Expect: 100-continue 

HTTP/1.1 100 Continue 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0 21942 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 HTTP/1.1 500 Internal Server Error 
Date: Wed, 15 Sep 2010 05:15:52 GMT 
X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5 
Content-Type: text/xml 
Content-Length: 0 
Connection: close 
100 21942 0  0 100 21942  0 216k --:--:-- --:--:-- --:--:-- 535k* Closing connection #0 

* About to connect() to api.notificationmessaging.com port 443 
* Trying 81.92.116.8... * connected 
* Connected to api.notificationmessaging.com (81.92.116.8) port 443 
* successfully set certificate verify locations: 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using RC4-MD5 
* Server certificate: 
*  subject: /C=FR/ST=Hauts de Seine/L=Clichy/O=Emailvision/OU=Provided by TBS INTERNET http://www.tbs-certificats.com//CN=*.notificationmessaging.com 
*  start date: 2008-09-20 09:09:15 GMT 
*  expire date: 2010-09-20 09:09:15 GMT 
*  issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected] 
* SSL certificate verify ok. 
POST /NMSXML HTTP/1.1 
Host: api.notificationmessaging.com 
Accept: */* 
Content-Length: 11602 
Content-Type: application/x-www-form-urlencoded 
Expect: 100-continue 

HTTP/1.1 100 Continue 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0 11602 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 HTTP/1.1 500 Internal Server Error 
Date: Wed, 15 Sep 2010 05:15:52 GMT 
X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5 
Content-Type: text/xml 
Content-Length: 0 
Connection: close 
100 11602 0  0 100 11602  0 118k --:--:-- --:--:-- --:--:-- 306k* Closing connection #0 

* About to connect() to api.notificationmessaging.com port 443 
* Trying 81.92.116.8... * connected 
* Connected to api.notificationmessaging.com (81.92.116.8) port 443 
* successfully set certificate verify locations: 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using RC4-MD5 
* Server certificate: 
*  subject: /C=FR/ST=Hauts de Seine/L=Clichy/O=Emailvision/OU=Provided by TBS INTERNET http://www.tbs-certificats.com//CN=*.notificationmessaging.com 
*  start date: 2008-09-20 09:09:15 GMT 
*  expire date: 2010-09-20 09:09:15 GMT 
*  issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected] 
* SSL certificate verify ok. 
POST /NMSXML HTTP/1.1 
Host: api.notificationmessaging.com 
Accept: */* 
Content-Length: 2178 
Content-Type: application/x-www-form-urlencoded 
Expect: 100-continue 

HTTP/1.1 100 Continue 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0 2178 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 HTTP/1.1 200 OK 
Date: Wed, 15 Sep 2010 05:15:53 GMT 
X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5 
Content-Type: application/xml;charset=utf-8 
Content-Length: 82 
Connection: close 
100 2260 0 82 100 2178 777 20644 --:--:-- --:--:-- --:--:-- 45375* Closing connection #0 

* About to connect() to api.notificationmessaging.com port 443 
* Trying 81.92.116.8... * connected 
* Connected to api.notificationmessaging.com (81.92.116.8) port 443 
* successfully set certificate verify locations: 
* CAfile: /etc/pki/tls/certs/ca-bundle.crt 
    CApath: none 
* SSL connection using RC4-MD5 
* Server certificate: 
*  subject: /C=FR/ST=Hauts de Seine/L=Clichy/O=Emailvision/OU=Provided by TBS INTERNET http://www.tbs-certificats.com//CN=*.notificationmessaging.com 
*  start date: 2008-09-20 09:09:15 GMT 
*  expire date: 2010-09-20 09:09:15 GMT 
*  issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/[email protected] 
* SSL certificate verify ok. 
POST /NMSXML HTTP/1.1 
Host: api.notificationmessaging.com 
Accept: */* 
Content-Length: 2178 
Content-Type: application/x-www-form-urlencoded 
Expect: 100-continue 

HTTP/1.1 100 Continue 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0 2178 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0 

下面是我用來提出請求的卷頁代碼片段。

 
curl_setopt($ch, 
CURLOPT_URL,'https://api.notificationmessaging.com/NMSXML'); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $sXML); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 600); 
curl_setopt($ch, CURLOPT_VERBOSE, TRUE); 
curl_setopt($ch, CURLOPT_NOPROGRESS, 0); 
$res = curl_exec($ch); 

有人可以請幫忙。

感謝

UPDATE: 發現問題是像XML â一些字符,如馬克指出。現在有沒有一種方法可以刪除/轉換所有未在xml中識別的字符?

+0

不確定提出什麼解決方案,但是這表示字符編碼問題,如果這有助於您指出正確的方向。 – 2010-09-15 07:16:35

回答

2

500意味着他們的系統存在編程錯誤,而不是你的系統。這可能是由你發送錯誤參數引起的,但它們應該以不同的方式處理。

我會通知公司你正在做的事情是造成500人,他們應該能夠在他們的最終解決它。