Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to hide get parameters in url php

function strip_param_from_url( $url, $param ) {
    $base_url = strtok($url, '?');              // Get the base url
    $parsed_url = parse_url($url);              // Parse it 
    $query = $parsed_url['query'];              // Get the query string
    parse_str( $query, $parameters );           // Convert Parameters into array
    unset( $parameters[$param] );               // Delete the one you want
    $new_query = http_build_query($parameters); // Rebuilt query string
    return $base_url.'?'.$new_query;            // Finally url is ready
}
// Usage
echo strip_param_from_url( 'http://url.com/search/?location=london&page_number=1', 
	'location' )
Comment

PREVIOUS NEXT
Code Example
Php :: php import function from another file 
Php :: string to int laravel 
Php :: add a new column to existing table in a migration 
Php :: php header excel utf-8 
Php :: php loop through objects 
Php :: wordpress wpdb 
Php :: laravel read origanl value before update 
Php :: websocket 2006 MySQL server has gone away 
Php :: check php version 
Php :: add new column to table laravel 
Php :: replace all php 
Php :: laravel artisan progress bar 
Php :: Deprecated Functionality: stripos() 
Php :: get today date in php 
Php :: laravel ide-helper 
Php :: php get files in folder 
Php :: laravel mail success or failure 
Php :: php convert number to month 
Php :: exclude methods in resource route laravel 
Php :: generating-random-token-php 
Php :: php get all values from associative array 
Php :: get current year php 
Php :: what is forelse in laravel 
Php :: laravel create project command 
Php :: take last four digits php 
Php :: migrate to an existing table in laravel commad 
Php :: how to declar a variable in php 
Php :: grouping routes in laravel 
Php :: Too Many Attempts. laravel error 
Php :: guzzle post request with data 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =