base64_encode for each url found .

Hi, my name is Michael, my first post

Have

Im using curl to pull a file via http.

Im able to encode values/ and only 1 URL found in the in results of the curl, but each URL found base64 encodes all of them using the first URL found.

What should I do?

//remove virgin links
$headlines = str_replace("<a href", “<a hhref”, $headlines);

$str = $storyurl;
$text = base64_encode($str);

//remove virgin urls and put back links as encrpyed
$contents = preg_replace("/<a href=(.*)>/Usi", “<a href=http://myurl.com/encoded.php?result=$text>”, $contents);

preg_match_all("//i", $contents, $matches);
foreach($matches[1] as $url){
$urle = base64_encode($url);
print $url;
print $urle."

";

$contents = preg_replace("/<a href=(.*)>/Usi", “<a href=http://myurl.com/encoded.php?result=$urle>”, $contents);

}

Thank you in advance :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service