0

I know this question as been asked several times but it keep getting an error message when i do my curl request. I've seen several forums and several curl cmd converter but they arn't going anywhere for me.

Here is my curl request that work on cmd :

curl -X POST --form "inputXml=@ABBE.Xml" http://localhost:8012/RemoteServXml

Here is my curl code on php that returns me an error :

$post = 'inputXml='.$req;   
        }
        try {
            $curl = curl_init();
            curl_setopt ($curl, CURLOPT_URL, $xmlserverurl);
            curl_setopt ($curl, CURLOPT_HEADER, false);
            curl_setopt ($curl, CURLOPT_POST, 1);
            curl_setopt ($curl, CURLOPT_POSTFIELDS, $post);
            curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 60);
            curl_setopt ($curl, CURLOPT_TIMEOUT, 300);
            curl_setopt ($curl, CURLOPT_VERBOSE, true);
            $buffer = curl_exec ($curl);

"<!doctype html>État HTTP 500 – Erreur interne du serveurbody {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}

État HTTP 500 – Erreur interne du serveur

Type Rapport d'état

message Error executing job: Error reading log file: <?xml version="1.0"?> <error component="XmlUtils" desc="XML parsing error. See Message for details." source="saxerrorhandler.cpp:105"><extra-info key="Message" value="unexpected end of input"/><extra-info key="Source" value="C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp\AServer_Input6741993457441879710.xml:374:3301"/></error"

i tested it with utf8_encode but it still don't work.

Thanks in advance !

**UPDATE 1 :** 

Error log on apache/php : 
'"55924"' n'est pas reconnu en tant que commande interne
ou externe, un programme ex‚cutable ou un fichier de commandes.
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 8090 (#0)
> POST /RemoteServXml  HTTP/1.1
Host: localhost:8090
Accept: */*
Accept-Encoding: deflate, gzip
Content-Length: 64287
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

< HTTP/1.1 100 
< HTTP/1.1 500 
< Content-Type: text/html;charset=utf-8
< Content-Language: fr
< Content-Length: 1207
< Date: Fri, 28 Aug 2020 07:22:42 GMT
< Connection: close
< 
* Closing connection 0
  • What's in `$req`? – Alex Howansky Aug 27 '20 at 15:50
  • Also please note that PHP 5.5 was end-of-lifed over 4 years ago, you're not going to find much support for it. – Alex Howansky Aug 27 '20 at 15:51
  • If you get a 500 error, you need check your web servers error log for the actual error message. If you're working locally, you can set PHP to [show all errors](https://stackoverflow.com/questions/5438060/showing-all-errors-and-warnings) to get the actual error messages directly on the screen. As far as we know, the error might not happen in the cURL code at all, but could be before or after. – M. Eriksson Aug 27 '20 at 15:52
  • in $req there is a string containing a lot of lines ( if i export it as ABBE.Xml and do it in the cmd , it works ) – LeVoltaireDesChamps Aug 27 '20 at 16:07
  • i added a log error based on your answer @MagnusEriksson but nothing very explicit – LeVoltaireDesChamps Aug 28 '20 at 07:29
  • It appears that my input is truncated, i'm searching for a solution to not make this happen. C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp ( i have access to file temporarely like 0.5sec and its deleted but i managed to copy them ) – LeVoltaireDesChamps Aug 28 '20 at 12:23

0 Answers0