HTTP GET and POST APIs in PHP
I have searched quite a bit and did not find a easy to use library for making simple GET or POST requests in PHP. This library provides that functionality.

This package is free software. It is distributed under LGPL - legalese removed, it means that you can use this for any purpose, but cannot charge for this software. Any enhancements you make to this piece of code, should be made available free to the general public! You should also carry a link to this page for users to download the latest version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Download the PHP code

Usage Example:

// Get google
get("www.google.com", "80", "/");

// Get a specific resource 
get("www.google.com","80", "/terms_of_service.html");

// Get a specific resource and pass query string
get("www.google.com", "80", "/search?q=test");

// Post a request (Google doesn't process POST requests!)
post("search.yahoo.com", "80", "/search","p=test&sm=Yahoo+Search");




Links
Home