|
|
|
| Здравия
Не могу найти толкового описания, как отправить полноценный и корректный запрос PUT~ом...
Задача тривиальна: туда надо послать XML. Это система блог-спот(blogspot.com) и умные парни из гугла, но черт возьми, Холмс, как?
+ что, правильно, кодировать какими то base-encode,url-encode и пр при генерации XML?..
Текущий код похож на:
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Authorization: GoogleLogin auth=" . $auth;
$header[] = "Content-Type: application/x-www-form-urlencoded";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $xml_tag['edit'] );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_PUT, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_xml_encoded);
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
$html = curl_exec($curl);
curl_close($curl);
|
где
$auth - секретная фраза гугла
$xml_tag['edit'] - урл, куда стучимся
$post_xml_encoded - сгенеренный мной XML | |
|
|
|
|
|
|
|
для: Xenos
(03.05.2011 в 20:01)
| | А что у вас в $post_xml_encoded ? | |
|
|
|
|
|
|
|
для: cheops
(03.05.2011 в 20:14)
| | {cutted} | |
|
|
|
|
|
|
|
для: Xenos
(03.05.2011 в 20:01)
| | Чтож... жаль, что ответа нет.
Радует, что докопался сам: фейк был в подсказке, что нашел где-то.
http://www.php.net/manual/en/function.curl-setopt.php#96056
> curl_setopt($curl, CURLOPT_PUT, 1);
>
|
Это левак.......... Одна единичка все запорола.... | |
|
|
|