本文整理汇总了PHP中Am_HttpRequest::setUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_HttpRequest::setUrl方法的具体用法?PHP Am_HttpRequest::setUrl怎么用?PHP Am_HttpRequest::setUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_HttpRequest
的用法示例。
在下文中一共展示了Am_HttpRequest::setUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _request
protected function _request($function, $method, $params = null)
{
$this->_request->setUrl(self::API_URL . '/' . $function);
$nonce = sprintf('%0.0f', round(microtime(true) * 1000000));
$data = $nonce . self::API_URL . '/' . $function . http_build_query($params);
$this->_request->setHeader(array('ACCESS_KEY' => $this->_key, 'ACCESS_SIGNATURE' => hash_hmac('sha256', $data, $this->_secret), 'ACCESS_NONCE' => $nonce));
$this->_request->setMethod($method);
if (!empty($params)) {
$this->_request->addPostParameter($params);
}
$resp = $this->_request->send();
if ($resp->getStatus() != 200) {
throw new Am_Exception_InternalError('CoinBase: Status for API request was not 200. Got: ' . $resp->getStatus());
}
$data = json_decode($resp->getBody());
if (is_null($data)) {
throw new Am_Exception_InternalError('CoinBase: Unable to decode response. Got: ' . $resp);
}
if (!@$data->success) {
throw new Am_Exception_InternalError('CoinBase: Not successfull response.Got: ' . print_r($data, true));
}
return $data;
}
示例2: _sendRequest
/** @return HTTP_Request2_Response */
public function _sendRequest(Am_HttpRequest $request)
{
$request->addPostParameter('x_login', $this->getConfig('login'));
$request->addPostParameter('x_tran_key', $this->getConfig('tkey'));
$request->addPostParameter('x_Delim_Data', "True");
$request->addPostParameter('x_Delim_Char', "|");
$request->addPostParameter('x_Version', "3.1");
$request->addPostParameter('x_method', "ECHECK");
if ($this->getConfig('test_mode')) {
$request->addPostParameter("x_test_request", "TRUE");
$request->setUrl(self::SANDBOX_URL);
} else {
$request->setUrl(self::LIVE_URL);
}
$request->setMethod(Am_HttpRequest::METHOD_POST);
return $request;
}
示例3: resendPostback
function resendPostback()
{
if ($this->plugin->getConfig('resend_postback')) {
$urls = $this->plugin->getConfig('resend_postback_urls');
$urls = explode("\n", $urls);
$urls = array_filter(array_map('trim', $urls));
foreach ($urls as $url) {
try {
$tm = microtime(true);
$this->log->add("Resending postback to [{$url}]");
if ($url == $this->plugin->getPluginUrl('ipn')) {
throw new Am_Exception_Configuration("DO NOT CONFIGURE RESENDING IPN TO ITSELF!");
}
$req = new Am_HttpRequest($url);
$req->setConfig('connect_timeout', 1000);
$req->setConfig('timeout', 2000);
$method = strtoupper($this->request->getMethod());
$req->setMethod($method);
if ($method == 'POST') {
foreach ($this->request->getPost() as $k => $v) {
$req->addPostParameter($k, $v);
}
} else {
$arr = $this->request->getQuery();
$req->setUrl($req->getUrl() . '?' . http_build_query($arr));
}
$req->send();
$tm = sprintf('%.3f', microtime(true) - $tm);
$this->log->add("Postback resent succesfully ({$tm} sec)");
} catch (Exception $e) {
$tm = sprintf('%.3f', microtime(true) - $tm);
$this->log->add("Cannot resend postback ({$tm} sec)");
$this->log->add($e);
}
}
}
}
示例4: dirname
<?php
require_once dirname(__FILE__) . '/bootstrap.php';
@set_time_limit(3600);
$req = new Am_HttpRequest();
$req->setConfig('connect_timeout', 120);
$req->setConfig('timeout', 3600);
$req->setUrl(Am_Di::getInstance()->config->get('root_url') . '/cron');
$resp = $req->send();