0

I am using the REST API to test web service for mobile application. I have written the web service in PHP & passed the value to "signatureimage" variable as base64 encode string as below

iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==

but in PHP web service when I print the received the post value it gives the below value

iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD/// l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==

Means the "+" character replaced with " "(space). I want the strictly same passed string as is in PHP web service.

Please suggest me the solution.

barudo
  • 665
  • 4
  • 13
  • when printing it try wraping it in `
    ` tags.. It might be only a display issue
    – Mihai Matei Nov 23 '16 at 07:32
  • 1
    Same question asked here : http://stackoverflow.com/questions/9032233/remove-whitespaces-from-base64-encoded-string-when-posting – Kapil Yadav Nov 23 '16 at 07:32
  • The string which contacins "+" has posted from mobile application to PHP web service but when I receive it at PHP web service this "+" sign replaced by space. This not regarding only for "+" but I need the sting as is passed from mobile application to PHP web service. – Omprakash Lilhare Nov 23 '16 at 07:41

1 Answers1

0

You need to replace + sign with %2B. There are different ways to do that. like uri_escape(base64_encode($your_base64_string))

Hope it'll resolve your problem.

Thanks

Delickate
  • 1,102
  • 1
  • 11
  • 17
  • The string which contacins "+" has posted from mobile application to PHP web service but when I receive it at PHP web service this "+" sign replaced by space. This not regarding only for "+" but I need the sting as is passed from mobile application to PHP web service. – Omprakash Lilhare Nov 23 '16 at 07:41