Problem with ASCII and URL encoding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hidz_stitch
Forum Newbie
Posts: 2
Joined: Wed May 13, 2009 8:08 am

Problem with ASCII and URL encoding

Post by hidz_stitch »

Help!!
Can anybody tell me is there any way to ascii encode the pdf file then do the url encode and vice versa?

pdf file -> ascii encode -> url encode
url decode -> ascii decode -> pdf


can anyone show me the example??
I really stuck on it.. :cry:
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Problem with ASCII and URL encoding

Post by Darhazer »

Code: Select all

$content = file_get_contents($pdfFile);
$ascii = base64_encode($content);
$url = url_encode($ascii);
 
$ascii = url_decode($url);
$content = base64_decode($ascii);
 
Any questions?
Last edited by Benjamin on Thu May 14, 2009 4:21 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply