My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

Rayap is a PHP based Object oriented wrapper for most of curl functions. It simplifies and making the use of curl was very easy in PHP. Here is simple example how to use Rayap.

Simple GET Request

<?php
include_once('rayap.php');

// instance the class
$r = new Rayap();
// fetch a page (using GET)
$result = $r->rayap_get_page('http://www.google.com/');
// close the connection
$r->rayap_close();
// print result
echo $result;
?>

Simple POST Request

<?php
include_once('rayap.php');

// instance the class
$r = new Rayap('http://example.com/login.php');
// set request method to POST
$r->method = 'POST';
// just to make sure we follow the redirection
$r->always_follow = TRUE;
// build the post data
$data = array(
  'username' => 'foo',
  'password' => 'bar',
  'submit' => 'Login'
);
$r->rayap_set_postdata($data);
// ok, now shot the URL
$result = $r->rayap_exec();
// close the connection
$r->rayap_close();
// print the result
echo $result;
?>

Sounds easy right? :).

System Requirements

  • OS: Any
  • PHP Version: >= 4.3
  • PHP Curl Extention: >= 7.x

Note:

use phpinfo() function to examine your system

Powered by Google Project Hosting