| |||||||||||
| |||||||||||
Accessing a page via POST from within a PHP script
In PHP, you can use a file function to read the whole contents of a file into an array, and you've got a whole variety of other functions to open and read files in other ways too. If you want to read from a web page (a URL) via the GET method, that's easy too - simply put the URL in instead of the file name and PHP will work it out for you.
But what if you want to access a page from your server via the POST method? That's a little more complex, but it can be done; I had cause yesterday, and I wrote a sample posting script ... see full source code. If you're into this sort of thing, you'll notice I've used the more complex HTTP 1.1 protocol to ensure that my script will work even on virtual hosts sharing a single IP address, and that I've checked for the existance of a robots.txt file. To some extent, the script I've written is an automaton or robot, and so this chsck should be made. It runs very nicely and it's quite a useful tool for learning how HTTP 1.1 and POST protocols work. (written 2005-09-26 00:03:14) Associated topics are indexed under H112 - PHP - Further Web Page and Network Handling
Some other Articles
A Stengthening dayTime conversions in Perl Commenting Perl regular expressions Is enough enough? Accessing a page via POST from within a PHP script Wheelchair access - can do! Matching in MySQL Out of the norm. Tomorrow's meeting. Up early 1754 posts, page by page
Link to page ... 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 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 0800 043 8225 or 01225 708225 • FAX: 0845 8382 405 or 01225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||