本文整理汇总了PHP中HTTP_Request::clearPostData方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP_Request::clearPostData方法的具体用法?PHP HTTP_Request::clearPostData怎么用?PHP HTTP_Request::clearPostData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP_Request
的用法示例。
在下文中一共展示了HTTP_Request::clearPostData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendTrackback
/**
* Send a trackback to a site
*
* @access public
* @param string $title Title of the Site
* @param string $excerpt The Excerpt
* @param string $permalink The Permalink to send
* @param array $to Where to send the trackback
*/
function SendTrackback($title, $excerpt, $permalink, $to)
{
$title = urlencode(stripslashes($title));
$excerpt = urlencode(stripslashes($excerpt));
$blog_name = urlencode(stripslashes($this->gadget->registry->fetch('site_name', 'Settings')));
$permalink = urlencode($permalink);
require_once PEAR_PATH . 'HTTP/Request.php';
$options = array();
$timeout = (int) $this->gadget->registry->fetch('connection_timeout', 'Settings');
$options['timeout'] = $timeout;
if ($this->gadget->registry->fetch('proxy_enabled', 'Settings') == 'true') {
if ($this->gadget->registry->fetch('proxy_auth', 'Settings') == 'true') {
$options['proxy_user'] = $this->gadget->registry->fetch('proxy_user', 'Settings');
$options['proxy_pass'] = $this->gadget->registry->fetch('proxy_pass', 'Settings');
}
$options['proxy_host'] = $this->gadget->registry->fetch('proxy_host', 'Settings');
$options['proxy_port'] = $this->gadget->registry->fetch('proxy_port', 'Settings');
}
$httpRequest = new HTTP_Request('', $options);
$httpRequest->setMethod(HTTP_REQUEST_METHOD_POST);
foreach ($to as $url) {
$httpRequest->setURL($url);
$httpRequest->addPostData('title', $title);
$httpRequest->addPostData('url', $permalink);
$httpRequest->addPostData('blog_name', $blog_name);
$httpRequest->addPostData('excerpt', $excerpt);
$resRequest = $httpRequest->sendRequest();
$httpRequest->clearPostData();
}
}
示例2: post
/**
* 投稿実行
*/
public function post()
{
$hr = new HTTP_Request($this->getPostUrl());
$hr->addHeader('X-WSSE', $this->wsse);
$hr->addHeader('Accept', 'application/x.atom+xml, application/xml, text/xml, */*');
$hr->addHeader('Authorization', 'WSSE profile="UsernameToken"');
$hr->addHeader('Content-Type', 'application/x.atom+xml');
$hr->addRawPostData($this->getRawdata());
$hr->setMethod(HTTP_REQUEST_METHOD_POST);
$hr->sendRequest();
$hr->clearPostData();
}
示例3: _fakeLogin
/**
* Fake a virtua login on the patron's behalf.
* - Return a session id.
*
* @param array $patron Array with cat_username/cat_password keys
*
* @return string Session ID
* @access private
*/
private function _fakeLogin($patron)
{
// Get the iPortal server
$web_server = $this->_config['Catalog']['webhost'];
$virtua_url = "http://{$web_server}/cgi-bin/chameleon";
$client = new HTTP_Request();
$client->setMethod(HTTP_REQUEST_METHOD_POST);
$client->setURL($virtua_url);
$client->addPostData("SourceScreen", "INITREQ");
$client->addPostData("conf", "./chameleon.conf");
$client->addPostData("elementcount", "1");
$client->addPostData("function", "PATRONATTEMPT");
$client->addPostData("host", $this->_config['Catalog']['host_string']);
$client->addPostData("lng", "en");
$client->addPostData("login", "1");
$client->addPostData("pos", "1");
$client->addPostData("rootsearch", "KEYWORD");
$client->addPostData("search", "NOSRCH");
$client->addPostData("skin", "homepage");
$client->addPostData("patronid", $patron['cat_username']);
$client->addPostData("patronpassword", $patron['cat_password']);
$client->addPostData("patronhost", $this->_config['Catalog']['patron_host']);
$result = $client->sendRequest();
$client->clearPostData();
if (!PEAR::isError($result)) {
// Get the response
$result = $client->getResponseBody();
// Now find the sessionid. There should be one in the meta tags,
// so we can look for the first one in the document
// eg. <meta http-equiv="Refresh" content="30000;
// url=http://libwebtest2.usq.edu.au:80/cgi-bin/chameleon?sessionid=
//2009071712483605131&skin=homepage&lng=en&inst=
//consortium&conf=.%26%23047%3bchameleon.conf&timedout=1" />
$start = strpos($result, 'sessionid=') + 10;
$end = strpos($result, '&skin=');
return substr($result, $start, $end - $start);
}
}
示例4: array
$req = new HTTP_Request("http://www.ec-cube.net/mall/use_site.php");
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$arrSendData = array();
foreach ($_POST as $key => $val) {
if (ereg("^senddata_*", $key)) {
$arrSendDataTmp = array(str_replace("senddata_", "", $key) => $val);
$arrSendData = array_merge($arrSendData, $arrSendDataTmp);
}
}
$req->addPostDataArray($arrSendData);
if (!PEAR::isError($req->sendRequest())) {
$response1 = $req->getResponseBody();
} else {
$response1 = "";
}
$req->clearPostData();
break;
case 'return_step0':
$objPage = lfDispStep0($objPage);
break;
case 'return_step1':
$objPage = lfDispStep1($objPage);
break;
case 'return_step2':
$objPage = lfDispStep2($objPage);
break;
case 'return_step3':
$objPage = lfDispStep3($objPage);
break;
case 'return_agreement':
$objPage = lfDispAgreement($objPage);
示例5: replace
function replace ($photo, $photo_id, $async = null) {
$upload_req = new HTTP_Request();
$upload_req->setMethod(HTTP_REQUEST_METHOD_POST);
$upload_req->setURL($this->Replace);
$upload_req->clearPostData();
//Process arguments, including method and login data.
$args = array("api_key" => $this->api_key, "photo_id" => $photo_id, "async" => $async);
if (!empty($this->email)) {
$args = array_merge($args, array("email" => $this->email));
}
if (!empty($this->password)) {
$args = array_merge($args, array("password" => $this->password));
}
if (!empty($this->token)) {
$args = array_merge($args, array("auth_token" => $this->token));
} elseif (!empty($_SESSION['phpFlickr_auth_token'])) {
$args = array_merge($args, array("auth_token" => $_SESSION['phpFlickr_auth_token']));
}
ksort($args);
$auth_sig = "";
foreach ($args as $key => $data) {
if ($data !== null) {
$auth_sig .= $key . $data;
$upload_req->addPostData($key, $data);
}
}
if (!empty($this->secret)) {
$api_sig = md5($this->secret . $auth_sig);
$upload_req->addPostData("api_sig", $api_sig);
}
$photo = realpath($photo);
$result = $upload_req->addFile("photo", $photo);
if (PEAR::isError($result)) {
die($result->getMessage());
}
//Send Requests
if ($upload_req->sendRequest()) {
$this->response = $upload_req->getResponseBody();
} else {
die("There has been a problem sending your command to the server.");
}
if ($async == 1)
$find = 'ticketid';
else
$find = 'photoid';
$rsp = explode("\n", $this->response);
foreach ($rsp as $line) {
if (ereg('<err code="([0-9]+)" msg="(.*)"', $line, $match)) {
if ($this->die_on_error)
die("The Flickr API returned the following error: #{$match[1]} - {$match[2]}");
else {
$this->error_code = $match[1];
$this->error_msg = $match[2];
$this->parsed_response = false;
return false;
}
} elseif (ereg("<" . $find . ">(.*)</", $line, $match)) {
$this->error_code = false;
$this->error_msg = false;
return $match[1];
}
}
}
示例6: sfSendPostData
function sfSendPostData($url, $arrData, $arrOkCode = array())
{
require_once DATA_PATH . "module/Request.php";
// 送信インスタンス生成
$req = new HTTP_Request($url);
$req->addHeader('User-Agent', 'DoCoMo/2.0 P2101V(c100)');
$req->setMethod(HTTP_REQUEST_METHOD_POST);
// POSTデータ送信
$req->addPostDataArray($arrData);
// エラーが無ければ、応答情報を取得する
if (!PEAR::isError($req->sendRequest())) {
// レスポンスコードがエラー判定なら、空を返す
$res_code = $req->getResponseCode();
if (!in_array($res_code, $arrOkCode)) {
$response = "";
} else {
$response = $req->getResponseBody();
}
} else {
$response = "";
}
// POSTデータクリア
$req->clearPostData();
return $response;
}