2017 © Pedro Peláez
 

library httpurl

easy http url in PHP. (get, post, put, delete for both 'curl' and 'file_get_content')

image

httpurl/httpurl

easy http url in PHP. (get, post, put, delete for both 'curl' and 'file_get_content')

  • Monday, April 16, 2018
  • by elboza
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

HttpUrl

easy http url in PHP

set_transfer_mode ~~> 'curl' | 'fopen'
set_post_encode   ~~> 'json' | 'form'
set_show_headers  ~~>  true  |  false 
  • 'fopen' is the default transfer mode.
  • 'form' is the default post encodeing.
  • false is the default show header.
get    ($url,$params=null,$transfer_mode=null)
post   ($url,$data,$encoding=null,$transfer_mode=null,$params=null)
put    ($url,$data,$encoding=null,$transfer_mode=null,$params=null)
delete ($url,$data,$encoding=null,$transfer_mode=null,$params=null)
  • $data has to be an array.

example

test.php file:, (*1)

test_connections();

//select transfer mode (curl or fopen)
$x->set_transfer_mode('curl');

//set if show headersin response
//$x->set_show_headers(true);

//run http server in the project root directory:
//php -S localhost:3000 -r .
$url='localhost:3000/test/test_server.php';

echo "

"; echo $x->get($url,array('data1'=>42)); echo "

"; echo $x->post($url,array('data1'=>'44')); echo "

"; echo $x->put($url,array('data1'=>'47')); echo "

"; echo $x->delete($url,array('data1'=>'48')); //add if json encoded request //echo $x->delete($url,array('data1'=>'48'),'json'); ?>

run:, (*2)

  • php -S localhost:3000 -r .
  • composer install

The Versions

16/04 2018

dev-master

9999999-dev

easy http url in PHP. (get, post, put, delete for both 'curl' and 'file_get_content')

  Sources   Download

beerware

by Fernando Iazeolla

16/04 2018

0.0.1

0.0.1.0

  Sources   Download

beerware

by Fernando Iazeolla