PHP cURL get request with parameters

Curl is the best way to get content of another website and traverse it according to your need. I already coverred PHP CURL tutorial with Examples in my previous posts. In this tutorial I will show you how to pass parameter in php curl get request

If you know wordpress a little then you notice that if you search anything on wordpress blog then it append values with blogurl/?s=value and display you search result. Just like below

php curl get parameters

Above image has query string in url and it also shows searched value in right bar input text.

We will be going to achieve exactly the same using curl.

URL:

Query String:


PHP curl get request:

Below php code search “PHP CURL” in wdb24.com. http_build_query() function encode given string.
If you want to learn more about htpp_build_query function then visit my post 10 PHP Url Functions – Every beginner must check

If you run above code to the browser then you will get output like below.

response php curl get

Also read:

 

Posted in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *