我正在開發一個XMLRPC客戶端,它必須支持用於驗證的cookie。如何獲得響應cookie並設置XML_RPC2的請求Cookie?XML_RPC2是否支持cookies?
0
A
回答
1
Cookies沒有被XML_RPC2
2
支持我假設你正在使用PHP/PEAR?
自版本1.1.0b1開始,該軟件包使用HTTP_Request2。
創建HTTP_Request2並把它傳遞給XML_RPC作爲選項參數使用Cookie:
<?php
//Include the PEAR packages
require_once 'XML/RPC2/Client.php';
require_once 'HTTP/Request2.php';
//Create the HTTP_Request2 object and add your cookie details
$http_request = new HTTP_Request2();
$http_request2->addCookie($name = 'myCookie', $value = 'myValue');
//Create the XML_RPC2_Client
$params = array('httpRequest'=>$http_request);
$client = XML_RPC2_Client::create($url = 'http://www.example.com', $params);
//do your stuff
?>
2
XML_RPC2支持餅乾,例如:
require_once 'XML/RPC2/Client.php';
require_once 'HTTP/Request2.php';
require_once 'HTTP/Request2/CookieJar.php';
$http_request = new HTTP_Request2();
$cookie = new HTTP_Request2_CookieJar();
$http_request->setCookieJar($cookie);
$options = array(
'prefix' => 'prefix.',
'httpRequest' => $http_request
);
$client = XML_RPC2_Client::create('http://api.host.com/xmlrpc/', $options);
$result = $client->login('LOGIN', 'PASSWORD');
var_dump($cookie);
$result = $client->get_info();
相關問題
- 1. Apache HttpClient如何支持cookies?
- 2. 是否支持MSNP9?
- 3. 是否支持DataGrid?
- 4. 是否支持ARC?
- 5. 哪些瀏覽器支持HttpOnly cookies?
- 6. Firefox是否支持enablePrivilege(「UniversalBrowserRead」)?
- 7. Xcode 4.3是否支持distcc?
- 8. GCC是否支持C++ AMP
- 9. PySide是否支持Python 3?
- 10. AlertDialog是否支持WebView?
- 11. GWT是否支持php?
- 12. 是否正式支持android.speech.extra.DICTATION_MODE?
- 13. Android 4.0.3是否支持SIP?
- 14. 是否支持WSE 3.0?
- 15. logback是否支持log4j appenders?
- 16. py2app是否支持python3?
- 17. Freemarker是否支持MethodDescriptors?
- 18. JOGL是否支持NURBS?
- 19. System.Data.OracleClient是否支持oracle 11g?
- 20. Dapper是否支持枚舉?
- 21. Azure是否支持AIX?
- 22. WCF + net.tcp是否支持3DES?
- 23. Xcode 4是否支持AVX?
- 24. Memecached是否支持PHP 7?
- 25. 是否由webgl支持texture2DRect?
- 26. NSIS是否支持IIS7?
- 27. Qt是否支持OpenMP?
- 28. aforge.net是否支持OCR?
- 29. Facebook是否支持oEmbed?
- 30. Swift是否支持WebRTC?