0

The site I am working on is using a .net Soap web service for getting data. The initial call returns XML that contains a base64 encoded string. I am able to isolate that string by using $lastResponse = $client->__getLastResponse(); When I use var_dump on the $last response variable I get some thing like string(10139) "77u/PD94bWwgdmV...=="

When I use echo I get 77u/PD94bWwgdmV...== without the string(10139) to start. I have tried to place the $lastResponse variable into the base64_decode function but it returns nothing at all, not even NULL. I have also tried to split the string first to remove the 77u/ from the start and that does not work at all.

    $lastResponse = $client->__getLastResponse();

    $splitResponse = preg_split("#/#", $lastResponse);

    echo base64_decode($lastResponse);

    echo base64_decode($splitResponse[1]);

    var_dump($splitResponse[1]);

    var_dump(base64_decode($splitResponse[1]));

    echo $lastResponse;

The code above returns this to the browser:

    string(0) "" string(0) "" 77u/PD94bWwgdmVyc2lvbj0....

But when I copy/paste everything after the 77u/ into an only decoder I get the decoded xml that I am supposed to have returned to me. I am very confused as to what I am missing here any help will be greatly appreciated.

3
  • How you worked with base64_decode function? Did you echo it?
    – pavel
    May 22, 2015 at 16:03
  • 1
    Please show the code you tried.
    – Barmar
    May 22, 2015 at 16:04
  • Updated question to show the code I used and what is returned
    – Nate58
    May 22, 2015 at 16:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.