PEAR HTTP Request

From Triangle Wiki

Jump to: navigation, search

{{Wrapper|NavigationFile=

Contents

Introduction

This page is created to bring together examples and knowledge from other resources. Providing real world tutorials for HTTP_request in a WIKI format for all users to contribute.

Provides an easy way to perform HTTP requests from within PHP scripts. Supports GET / POST / HEAD / TRACE / PUT / DELETE, Basic authentication, Proxy, Proxy Authentication, SSL, file uploads etc.

Because of the above mentioned features HTTP_Request makes it possible to mimic big parts of web browsers such as the widely-known Mozilla browser in PHP applications. Possible application areas are:

  • Checking the validity of WWW links with the help of getResponseCode().
  • Grabbing remote web pages and parsing the result.

Methods

addPostData

 if ($params['method'] == 'POST') {
   foreach ($url_string as $k => $v) {
     $req->addPostData($k, $v);
   }
 }

Examples

Hello World Example

<?php
 require_once 'HTTP/Request.php';

 $req =
Personal tools