当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpClient::doRequest方法代码示例

本文整理汇总了PHP中HttpClient::doRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpClient::doRequest方法的具体用法?PHP HttpClient::doRequest怎么用?PHP HttpClient::doRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpClient的用法示例。


在下文中一共展示了HttpClient::doRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getActualConfig

 public function getActualConfig()
 {
     if (!$this->_plugin instanceof FeedPlugin) {
         return false;
     }
     $request = new HttpRequest();
     $type = "pluginConfig";
     $response = $this->getAction($this->getVersion());
     $body = json_decode($response->getBody());
     if (!isset($body->{$type})) {
         return $response;
     } else {
         $url = $body->{$type};
     }
     $request->setUrl($url);
     $request->setHeaders($this->getSignHeader());
     $request->setHeaders($this->_defaultHeader());
     $request->setMethod('GET');
     /** @var HttpResponse $response */
     $response = $this->_client->doRequest($request);
     $body = json_decode($response->getBody());
     return $body;
 }
开发者ID:plescanicolai,项目名称:osCommerce,代码行数:23,代码来源:FeedApi.php

示例2: processImageByUpload

 public function processImageByUpload($image, $app_session = null, $seq_number = null, $format = null)
 {
     $parameters = array("image" => $image == null ? null : '@' . $image, "app_session" => $app_session, "seq_number" => $seq_number, "format" => $format);
     $response = HttpClient::doRequest(HttpMethod::POST, "https://" . self::PUBLIC_DNS . "/process/image/upload/", $parameters, $this->authHandlers, ContentType::MULTIPART, true);
     return $response;
 }
开发者ID:eXcomm,项目名称:3dfi-api-php,代码行数:6,代码来源:nViso3DFIHttpClient.php

示例3: directions

 public function directions($starting, $ending)
 {
     $parameters = array("starting" => $starting, "ending" => $ending);
     $response = HttpClient::doRequest(HttpMethod::GET, "https://" . self::PUBLIC_DNS . "/directions", $parameters, $this->authHandlers, ContentType::FORM, true);
     return $response;
 }
开发者ID:RatanPaul,项目名称:MapIT-Driving-Directions-API-Turorial,代码行数:6,代码来源:GoogleMapsDrivingDirections.php

示例4: HttpClient

/**
*	Testing REST methods work by communicating with api.php
*  api.php should be uploaded to a webserver, and the
*  $url below updated with the URL of that script.
**/
require_once 'HttpRequest.php';
require_once 'HttpResponse.php';
require_once 'HttpClient.php';
$url = 'http://localhost/api.php';
$http = new HttpClient();
// GET request
echo "GET request\n";
$request = new HttpRequest();
$request->setUrl($url . '?name1=a&name2=b');
$request->setMethod('GET');
$response = $http->doRequest($request);
echo $response->getStatus(), ': ', $response->getBody(), "\n";
echo "\n";
// POST REQUEST
echo "POST request\n";
$body = "This is a new note to myself.";
$request = new HttpRequest();
$request->setUrl($url);
$request->setMethod('POST');
$request->setBody($body);
$request->addHeader('Content-Type', 'text/plain');
$response = $http->doRequest($request);
//echo "Response: "; print_r($response);
echo $response->getStatus(), ': ', $response->getBody(), "\n";
echo "\n";
// PUT REQUEST
开发者ID:royopa,项目名称:php5-http-client,代码行数:31,代码来源:example-rest.php


注:本文中的HttpClient::doRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。