$client = new HttpClient('ws-test.truc.com/'); $client->setDebug(true); if (!$client->post(???)) //quoi mettre dedans pour envoyer mon fichier XML { echo 'Request failed! '; } else { echo ' '.strlen($client->getContent()).' bytes. '; }
function do_post_request($url, $data, $optional_headers = null) { $params array('http'> array( 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } $response = @stream_get_contents($fp); if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; } echo do_post_request('ws-test.truc.com/','XML/Vidage_CRLF.cml');
Fatal error: Uncaught exception 'Exception' with message 'Problem with ws-test.truc.com/, ' in D:\www\diagdirect\client.php:169 Stack trace: #0 D:\www\diagdirect\client.php(178): do_post_request('ws-test.truc.co...', 'XML/Vidage_CRLF...') #1 {main} thrown in D:\www\diagdirect\client.php on line 169
Fatal error: Uncaught exception 'Exception' with message 'Problem reading data from ws-test.truc.com/, ' in D:\www\diagdirect\client.php:173 Stack trace: #0 D:\www\diagdirect\client.php(178): do_post_request('ws-test.truc.co...', 'XML/Vidage_CRLF...') #1 {main} thrown in D:\www\diagdirect\client.php on line 173
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question