GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cision-block/src/Plugin/Http/RemoteRequest.php at master · Cyclonecode/cision-block

Expand file tree

/

RemoteRequest.php

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
39 lines (37 loc) · 1.22 KB
/

RemoteRequest.php

Copy path

File metadata and controls

39 lines (37 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace CisionBlock\Plugin\Http;
class RemoteRequest extends AbstractRequest
{
/**
* Performs a remote request.
* @param string $url
* @param array $args
* @return false|string
* @throws \Exception
*/
public function execute($url, array $args = array())
{
$defaults = array(
'method' => self::VERB_GET,
'timeout' => self::CURL_TIMEOUT,
'headers' => $this->headers,
);
$args = array_merge($defaults, $args);
$response = wp_safe_remote_request($url, $args);
if (!is_wp_error($response) && in_array(wp_remote_retrieve_response_code($response), array(200, 201))) {
$result = new Response(
wp_remote_retrieve_body($response),
wp_remote_retrieve_headers($response),
wp_remote_retrieve_response_code($response)
);
} else {
$code = wp_remote_retrieve_response_code($response);
/** @var \WP_Error|array $response */
throw new \Exception(
($response instanceof \WP_Error ? $response->get_error_message() : ''),
$code ? $code : 500
);
}
return $result;
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.