承接 rpurinton/https 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rpurinton/https

最新稳定版本:1.0.26

Composer 安装命令:

composer require rpurinton/https

包简介

Abstract Static Class for making HTTPS Requests in PHP/Composer

README 文档

README

Abstract Static Class for making HTTPS Requests in PHP/Composer

Usage

composer require rpurinton/https
<?php

require_once __DIR__ . '/vendor/autoload.php';

use RPurinton\HTTPS\HTTPSRequest;

// Define the options for the request
$options = [
    'url' => 'https://raw.githubusercontent.com/rpurinton/https/master/example.json',
    'method' => 'GET',
    'headers' => [
        'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' .
            'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36',
    ],
    'body' => '',
];

// Return the response as a string
$response_string = HTTPSRequest::fetch($options);
echo "Response as String: $response_string\n";

$response_array = json_decode($response_string, true);
echo "Response as Array: " . print_r($response_array, true) . "\n";

$response_object = json_decode($response_string);
echo "Response as Object: " . print_r($response_object, true) . "\n";

统计信息

  • 总下载量: 275
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-20