Tutorial by Examples

To separate a URL into its individual components, use parse_url(): $url = 'http://www.example.com/page?foo=1&bar=baz#anchor'; $parts = parse_url($url); After executing the above, the contents of $parts would be: Array ( [scheme] => http [host] => www.example.com [path...
You can use the header() function to instruct the browser to redirect to a different URL: $url = 'https://example.org/foo/bar'; if (!headers_sent()) { // check headers - you can not send headers if they already sent header('Location: ' . $url); exit; // protects from code being executed afte...
The http_build_query() will create a query string from an array or object. These strings can be appended to a URL to create a GET request, or used in a POST request with, for example, cURL. $parameters = array( 'parameter1' => 'foo', 'parameter2' => 'bar', ); $queryString = http_b...

Page 1 of 1