doudang2537 2010-09-15 05:51
浏览 41
已采纳

在cur中卷曲的问题?

I am using curl to send xml requests to API from Emailvision. I am having trouble lately where some requests result in "500 Internal Server Error", while others are sent without any errors.

The output of verbose is pasted below, can someone please help me interpret what might be causing the error.

* 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/emailAddress=premium-server@thawte.com
* 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/emailAddress=premium-server@thawte.com
* 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/emailAddress=premium-server@thawte.com
* 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/emailAddress=premium-server@thawte.com
* 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/emailAddress=premium-server@thawte.com
* 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

And below is the curl snippet I am using to make requests.

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);

Can someone please help.

Thanks

UPDATE: Found that the problem is with some characters like â in the xml, as pointed out by Mark. Now is there a way to remove/convert all chars not recognized in xml?

  • 写回答

1条回答 默认 最新

  • dougong8012 2010-09-15 05:54
    关注

    A 500 means there is a programming error with their system, not yours. It could be caused by you sending bad parameters, but they should be dealing with that in a different way.

    I'd inform the company that something you are doing is causing a 500, and they should be able to fix it on their end.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀