|
|
|
| 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 : |
1753 |
| 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);
?> | | |
|
| Function that does language negotiation based on the Accept-Language header, a cookie or host name Categories : HTTP, PHP, Cookies | | | Identify and log search engine access (spiders, robots, etc.) to a page. Categories : HTTP, Environment Variables, PHP, MySQL, Databases | | | Pseudo Non Parsed Header. Output to the the browser as the script runs. Categories : PHP, HTTP, HTML and PHP | | | Sending SMS Thru HTTP Categories : PHP, HTTP, SMS | | | 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 | | | A function to check if a URL exists Categories : PHP, CURL, HTTP | | | Remote File Saving with PHP - Download and serve a remote file. The content of the file will be updated at fixed intervals. Categories : PHP, Filesystem, Cache, Sockets, HTTP | | | Remote File Size Categories : PHP, Filesystem, HTTP, Sockets | | | The first step Guest Book ... ^^ Categories : MySQL, PHP, Apache, HTML, HTTP | | | PHP4 HTTP Compression Speeds up the Web Categories : PHP, Zlib, HTML and PHP, HTTP, Network | | | Simple Password example Categories : PHP, Authentication, Security, HTTP | | | Grab links from a page Categories : PHP, Regexps, HTTP | | | Gets the browser and OS from the $_SERVER['http_user_agent'] variable in PHP Categories : PHP, HTTP, Regexps | | | A simple script to count and report hits and the last
modification time of an HTML page. Requires MySQL support
(other DBs should work too, except possibly mSQL). Categories : HTTP, MySQL, PHP, Databases | | | Using php3 to upload files, uploading files, file uploads. Categories : PHP, Filesystem, HTTP | |
|
|
|