|
|
|
| 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 : |
4907 |
| 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);
?> | | |
|
| Class that allows the PHP developer to create and manage UNIX like password files suitable for use as Apache authentication password files.
Categories : HTTP, PHP, PHP Classes, Filesystem | | | 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 | | | Using php3 to upload files, uploading files, file uploads. Categories : PHP, Filesystem, HTTP | | | Remote File Size Categories : PHP, Filesystem, HTTP, Sockets | | | Gets the browser and OS from the $_SERVER['http_user_agent'] variable in PHP Categories : PHP, HTTP, Regexps | | | How to force the user to download a file instead of opening it up in an
controlled environment within the browser (i.e. MS Word/Adobe Acrobat) Categories : Browsers, PHP, HTTP | | | $REMOTE_HOST does not return a value. Categories : PHP, Global Variables, HTTP | | | Function that does language negotiation based on the Accept-Language header, a cookie or host name Categories : HTTP, PHP, Cookies | | | The following snippet gives complete info about all submitted
HTTP_POST_VARS and HTTP_GET_VARS Categories : Variables, HTTP, PHP | | | Script to check values being submitted by POST or GET method from a form. This script may help diagnose what variables are being supplied by a browser to other php scripts. Categories : HTML, Variables, Debugging, PHP, HTTP | | | valid link! Categories : HTTP, URLs, PHP | | | Upload Script, Upload File Script, Input Type="File" Categories : PHP, HTML and PHP, HTTP | | | PHP Domain Availability Checker Categories : PHP, Complete Programs, Regexps, HTTP, Sockets | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | A function to check if a URL exists Categories : PHP, CURL, HTTP | |
|
|