Can someone please tell me how to send a HTTP request through PHP .

Recommended Answers

All 2 Replies

Although I don't know anything about it there is a function called http_request(); and the official documentation can be found at http://php.net/manual/kr/function.http-request.php

Note that this is a pecl extension. You'll have to build it into PHP.

If you need just a simple HTTP Request, you can use file_get_contents().
This makes a HTTP GET Request to the URL you give it (if the http wrapper is enabled allow_url_fopen).

You can also use the curl functions:
http://www.php.net/manual/en/ref.curl.php

Or see the docs on getting remote files:
http://www.php.net/manual/en/features.remote-files.php

For custom HTTP Requests use CURL or you can use fsockopen(), with fread() and fwrite().

Pear also provides a HTTP package:
http://pear.php.net/package/HTTP_Request2

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.