|
|
|
| Title : |
A PHP function to make simple POST (and also GET) requests without using the CURL extension. |
| Categories : |
PHP, HTTP |
 Alix Axel |
| Date : |
Jun 19th 2008 |
| Grade : |
5 of 5 (graded 3 times) |
| Viewed : |
10785 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Alix Axel |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
|
|
|
|
Like this code?
Show the author your appreciation.
|
| |
| <?php
function Post($url, $post = null)
{
$context = array();
if (is_array($post))
{
ksort($post);
$context['http'] = array
(
'method' => 'POST',
'content' => http_build_query($post, '', '&'),
);
}
return file_get_contents($url, false, stream_context_create($context));
}
$data = array
(
'name' => 'Alix Axel',
'email' => '-----------@gmail.com',
'submit' => 'Subscribe',
);
echo Post('http://www.url.com/to/submit.php', $data);
?> | | |
|
| The simple counter with use MySql and gd. Categories : MySQL, HTTP, Graphics, PHP, Databases | | | HTTP Basic Authentication via POP3. Categories : Authentication, HTTP, Email, PHP | | | PHP Domain Availability Checker Categories : PHP, Complete Programs, Regexps, HTTP, Sockets | | | Authentication HTTP protocol POST Categories : Authentication, HTTP, PHP | | | Forcing a proxy to not cache a document Categories : HTTP, PHP | | | A function to check if a URL exists Categories : PHP, CURL, HTTP | | | How to let a user download a picture by clicking on it instead of needing to right click and Save-As. Categories : HTTP, PHP, HTML and PHP, Filesystem | | | header -- Send a raw HTTP header Categories : PHP, PHP Functions, HTTP | | | Gonx Proxy - This class is meant to act as an HTTP proxy to serve pages of a remote server as if they were local pages.
Categories : PHP, PHP Classes, HTTP | | | Simple pipe delimited file export program that downloads to a local machine Categories : PHP, Filesystem, Databases, MySQL, HTTP | | | Simple Password example Categories : PHP, Authentication, Security, HTTP | | | Produces browser-safe strings while preserving HTML tags. Categories : Strings, HTTP, PHP, HTML and PHP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Grab links from a page Categories : PHP, Regexps, HTTP | | | Sending SMS Thru HTTP Categories : PHP, HTTP, SMS | |
| |
| |
|