-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
50 lines (45 loc) · 1.08 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
About
=====
Rayap is a PHP based Object oriented wrapper for most of curl functions. It
simplify and making the use of curl very easy. Here is simple example how to
use Rayap.
=== Simple GET Request ===
<?php
// include the class
include_once('rayap.php');
// instance the class
$rayap = new Rayap();
// fetch a page (using GET)
$result = $rayap->get_page('http://www.google.com/');
// close the connection
$rayap->close();
// print result
echo $result;
?>
=== Simple POST Request ===
<?php
// include the class
include_once('rayap.php');
// instance the class
$rayap = new Rayap('http://example.com/login.php');
// set request method to POST
$rayap->method = 'POST';
// just to make sure we follow the redirection
$rayap->always_follow = TRUE;
// build the post data
$data = array(
'username' => 'foo',
'password' => 'bar',
'submit' => 'Login'
);
$rayap->set_postdata($data);
// ok, now shot the URL
$result = $r->exec();
// close the connection
$rayap->close();
// print the result
echo $result;
?>
Sounds easy right? :).
-----------------------
Copyright 2008 Rio Astamal (me@rioastamal.net)