How to pass a random string into another variable

I have two scripts. One is a tinyurl API and the other gnerates random strings. What I want to do it pass a random string into the tiny URL API script such that the tiny URL generated is always different


function createRandomPassword() { 

    $chars = "abcdefghijkmnopqrstuvwxyz023456789"; 
    $i = 0; 
    $pass = '' ; 

    while ($i <= 7) { 
        $num = rand() % 33; 
        $tmp = substr($chars, $num, 1); 
        $pass = $pass . $tmp; 

    return $pass; 


// Usage 
$password = createRandomPassword(); 



//gets the data from a URL  
function get_tiny_url($url)  
	$ch = curl_init();  
	$timeout = 5;  
	$data = curl_exec($ch);  
	return $data;  

//test it out!
$new_url = get_tiny_url(';

echo $new_url


where it says i want the password value in the first script to be passed before a tiny url is generated


missing the identifier.

As an aside: you should be taking modulus 35 on your random number, not 33. Taking mod 33 leaves you never using 8 or 9.

$new_url = get_tiny_url(“”.$password);

and then $_GET[‘pass’] will identify the script called in the index file.

$new_url = get_tiny_url('' . $password); 

What do you mean? I am missing identifier? I just corrected if OP was supposed to echo generated random text in the URL and he missed a $ sign from the $password variable.