Bonjour,
J'utilise la fonction send.php du tutoriel http://g-rossolini.developpez.com/tu...r/?page=update mais je n'arrive pas à la faire fonctionner.
Mon terminal cmd de windows me retourne:

>php.exe send.php testDocument file baseDeDocuments.xml

PHP Warning: file_get_contents(http://localhost:81/solr/testDocument/update): f
ailed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
in C:\wamp\www\testAntoine2\send.php on line 46
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\testAntoine2\send.php:0
PHP 2. file_get_contents() C:\wamp\www\testAntoine2\send.php:46

Warning: file_get_contents(http://localhost:81/solr/testDocument/update): failed
to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
in C:\wamp\www\testAntoine2\send.php on line 46

Call Stack:
0.0008 126392 1. {main}() C:\wamp\www\testAntoine2\send.php:0
0.0008 129824 2. file_get_contents() C:\wamp\www\testAntoine2\send.php
:46

bool(false)
string(44) "http://localhost:81/solr/testDocument/update"
done


De plus si je passe mon navigateur avec l'url http://localhost:81/solr/testDocument/update, on me renvoie :
HTTP ERROR 404

Problem accessing /solr/testDocumentation/update. Reason:

Not Found


Je ne comprends pas du comment du pourquoi.
De plus pour info j'utilise Bitnami Apache solr stack.

En espérant que vous pourrez m'aider

Cordialement,
Uruca


PS: send.php, j'ai effectué quelques changements pour le débug

<?php

if(PHP_SAPI != 'cli')
{
die('error: not sent via CLI'.PHP_EOL);
}

if($argc != 4 or !in_array($argv[2], array('file', 'string')))
{
die('usage is: '.basename(__FILE__).' CORENAME "file"|"string" FILENAME|CONTENTS'.PHP_EOL);
}

list(, $core_name, $content_type, $content) = $argv;
$url = 'http://localhost:81/solr/'.$core_name.'/update';
$data = '<add>
<doc>
<field name="idDocument">1</field>
<field name="titleFr">Le petit poucet</field>
</doc>
<doc>
<field name="idDocument">2</field>
<field name="titleFr">Le petit poucet</field>
</doc>
<doc>
<field name="idDocument">3</field>
<field name="titleFr">Les petits poucets</field>
</doc>
<doc>
<field name="idDocument">4</field>
<field name="titleFr">Le jeune arbre de la savane</field>
</doc>
</add>';

$params = array
(
'http' => array (
'method' => 'POST'
, 'header' => 'Content-Type: text/xml'
, 'content' => $data
, 'timeout' => 5
)
);

$context = stream_context_create($params);
$result = file_get_contents($url, FALSE, $context);
//var_dump (file_get_contents ('http://www.google.com/'));
var_dump($result);
var_dump($url);
echo 'done'.PHP_EOL;