Download the PHP package yxdj/network without Composer

On this page you can find all versions of the php package yxdj/network. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package network

HTTP工具包:请求调试,API客户端,网页采集

一、功能说明:

这是一个http工具包,你可以将它用作:

  1. 请求调试;
  2. API客户端;
  3. 网页采集;

特点:
请求传值:请求头域,GET参数,POST参数,COOKIE参数,及FILE参数,或是直接发送http请求头
调试信息:从请求的发起到响应结束,整个过程都有完整调试信息记录。
超时控制:连接超时,访问超时
页面跟踪:301,302
指定连接IP: 可免去DNS对域名解析,设定多个将随机选取
网页解析:关键字,编码,链接

二、安装/删除:

此工具要求php5.3以上,不需要核心以外的扩展,下文使用说明是基于5.4的语法操作(主要是数组表示)
此工具是作为一个composer包发布,但是核心文件Http.php并不对其它文件依赖,可以将其独立出来使用

安装:composer require yxdj/network
删除:composer remove yxdj/network

三、使用说明($http表示请求对象)

$http的获取:

方法一:$http = new \yxdj\network\Http();
方法二:$http = \yxdj\network\Api::gethttp(); //对方法一的调用,并保持单例

$http的操作:

发送请求:

注意:
上述url参数是必需的,其它可选
$get,$cookie,$post是名值对数组,可以是多维的
$file,示例:['myfile'=>['name'=>'文件名字','value'=>'文件内容'],...],
php服务端可以通过$_FILES['myfile']获取上述文件
get/post/head这3个方法是对rquest方法的简化,它们的返回仍是对象$http,但其中已有响应结果。
request的具体处理过程:

  1. 清除$http中上次的请求内容;
  2. 重新写入请求配置信息和获取的响应;
  3. 返回的$http可继续做获取响应操作

获取响应:

四、使用示例:

GET请求

自定义请求

封装API

$http已经能简单的发送参数,并能方便的获取响应
但在应用程序中使用它时,
往往还需在请求前对参数过滤分析,调整为可供发送的格式
在请求后还需对响应结果进行判断,解析,处理成最后需要的格式
可以将这个过程封装成一个API,以便更简便的调用

服务端定义:用户登录验证

客户端定义:请求发送与响应处理

TestApi::login()调用

您如果对此工具有兴趣或疑问,欢迎与我联系。


All versions of network with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yxdj/network contains the following files

Loading the files please wait ....