Convert Perl code to PHP code

Discussion in 'PHP' started by s_ruben, Apr 11, 2011.

  1. #1
    Hi,

    Please help me to convert this Perl code:

    
    use SOAP::Lite;
    
    my %uris = (
        'Session' => "$uri_base/Session",
    );
    
    my $session_service = SOAP::Lite
               ->uri($uris{'Session'})
               ->proxy($proxy)
               ;
    
    my $LoginResponse = $session_service->login($login, $password);
    
    my $session_id = $LoginResponse->result();
    print "Logged in with session $session_id\n";
    exit 0;
    
    Code (perl):
    to PHP code. I've tried this:

    
    try{   
        $uris = array("Session" => "$uri_base/Session");
    
        $session_service = new SoapClient(null, array("location" => $proxy, "uri" => $uris['Session']));
    
        $LoginResponse = $session_service->login($login, $password);
    
        $session_id = $LoginResponse->result();
    
        print "Logged in with session $session_id";
    }catch(SoapFault $e){
        print_r($e->getMessage());
    }
    
    PHP:
    but it returns "Could not connect to host ", when perl works fine.

    Thank you.
     
    s_ruben, Apr 11, 2011 IP