//Specify your URL $URL = "http://www.exampleurl.com"; //Open a stream in READ mode $handle = fopen ($URL, "r"); //Read the content of the URL and manipulate it. $key = str_replace(' ', '%20',fread($handle, 1000000));