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


PHP Response::getEffectiveUrl方法代码示例

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


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

示例1: mfForResponse

function mfForResponse(Guzzle\Http\Message\Response $resp)
{
    $html = $resp->getBody(true);
    $host = parse_url($resp->getEffectiveUrl(), PHP_URL_HOST);
    if ($host == 'twitter.com') {
        return Mf2\Shim\parseTwitter($html, $resp->getEffectiveUrl());
    } elseif ($host == 'facebook.com') {
        return Mf2\Shim\parseFacebook($html, $resp->getEffectiveUrl());
    } else {
        return Mf2\parse($html, $resp->getEffectiveUrl());
    }
}
开发者ID:taproot,项目名称:archive,代码行数:12,代码来源:Archive.php

示例2: resolveRequest

 private function resolveRequest(\Guzzle\Http\Message\Request $request)
 {
     try {
         $this->lastResponse = $request->send();
     } catch (\Guzzle\Http\Exception\TooManyRedirectsException $tooManyRedirectsException) {
         if ($this->hasRequestHistory($request)) {
             $this->lastResponse = $this->getRequestHistory($request)->getLastResponse();
         } else {
             return $request->getUrl();
         }
     } catch (\Guzzle\Http\Exception\BadResponseException $badResponseException) {
         if ($this->getConfiguration()->getRetryWithUrlEncodingDisabled() && !$this->getConfiguration()->getHasRetriedWithUrlEncodingDisabled()) {
             $this->getConfiguration()->setHasRetriedWithUrlEncodingDisabled(true);
             return $this->resolveRequest($this->deEncodeRequestUrl($request));
         } else {
             $this->lastResponse = $badResponseException->getResponse();
         }
     }
     if ($this->getConfiguration()->getHasRetriedWithUrlEncodingDisabled()) {
         $this->getConfiguration()->setHasRetriedWithUrlEncodingDisabled(false);
     }
     if ($this->getConfiguration()->getFollowMetaRedirects()) {
         $metaRedirectUrl = $this->getMetaRedirectUrlFromLastResponse();
         if (!is_null($metaRedirectUrl) && !$this->isLastResponseUrl($metaRedirectUrl)) {
             return $this->resolve($metaRedirectUrl);
         }
     }
     return $this->lastResponse->getEffectiveUrl();
 }
开发者ID:webignition,项目名称:url-resolver,代码行数:29,代码来源:Resolver.php

示例3: createPutRequest

 /**
  * Create a tailored PUT request for each file
  *
  * @param Response $response
  * @return \Guzzle\Http\Message\EntityEnclosingRequestInterface
  */
 protected function createPutRequest(Response $response)
 {
     $segments = Url::factory($response->getEffectiveUrl())->getPathSegments();
     $name = end($segments);
     // Retrieve content and metadata
     $file = $this->newContainer->dataObject()->setName($name);
     $file->setMetadata($response->getHeaders(), true);
     return $this->getClient()->put($file->getUrl(), $file::stockHeaders($file->getMetadata()->toArray()), $response->getBody());
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:15,代码来源:ContainerMigration.php

示例4: fromResponse

 /**
  * Construct a TransferPart from a HTTP response delivered by the API.
  *
  * @param Response $response
  * @param int      $partNumber
  * @return TransferPart
  */
 public static function fromResponse(Response $response, $partNumber = 1)
 {
     $responseUri = Url::factory($response->getEffectiveUrl());
     $object = new self();
     $object->setPartNumber($partNumber)->setContentLength($response->getHeader(Header::CONTENT_LENGTH))->setETag($response->getHeader(Header::ETAG))->setPath($responseUri->getPath());
     return $object;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:14,代码来源:TransferPart.php

示例5: getEffectiveUrl

 /**
  * {@inheritdoc}
  */
 public function getEffectiveUrl()
 {
     return $this->response->getEffectiveUrl();
 }
开发者ID:ramunasd,项目名称:platform,代码行数:7,代码来源:GuzzleRestResponse.php

示例6: pushLinksForResponse

function pushLinksForResponse(Guzzle\Http\Message\Response $resp)
{
    $self = null;
    $hubs = [];
    $linkHeader = $resp->getHeader('link');
    if ($linkHeader instanceof Guzzle\Http\Message\Header\Link) {
        $links = $linkHeader->getLinks();
        foreach ($links as $link) {
            if (strpos(" {$link['rel']} ", ' self ') !== false) {
                $self = $link['url'];
            }
            if (strpos(" {$link['rel']} ", ' hub ') !== false) {
                $hubs[] = $link['url'];
            }
        }
    }
    if (strpos($resp->getContentType(), 'html') !== false) {
        $mf = Mf2\parse($resp->getBody(true), $resp->getEffectiveUrl());
        if (!empty($mf['rels']['hub'])) {
            $hubs = array_merge($hubs, $mf['rels']['hub']);
        }
        if (!empty($mf['rels']['self']) and $self === null) {
            $self = $mf['rels']['self'][0];
        }
    }
    return ['self' => $self, 'hub' => $hubs];
}
开发者ID:taproot,项目名称:subscriptions,代码行数:27,代码来源:subscriptions.php


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