How to concatenate two strings and save the result to a variable?

0

I'm using an API to capture proxies . It returns me the proxies in the format JSON , as follows:

{
    "_links": {
        "_self": "\ / proxy",
        "_parent": "\ /"
    },
    "ip": "45.55.23.78",
    "porto": 1080,
    "protocolo": "socks5",
    "anonimato": "alto anonimato",
    "LastTested": "2018-03-09 06:51:27",
    "permiteRefererHeader": true
    "permiteUserAgentHeader": true
    "permiteCustomHeaders": true,
    "permiteCookies": true
    "permitePost": verdadeiro,
    "permiteHttps": true
    "país": "EUA",
    "connectTime": "0.721",
    "downloadSpeed": "160,000",
    "secondsToFirstByte": "1.079",
    "tempo de atividade": "99.164"
}

I want to get only the IP and the port , but I need to put the two together to get the result: 45.55.23.78:1080 >.

I was capturing this way:

$f = file_get_contents("link da minha api");
$json = json_decode($f);
 $proxy = $json->ip;
 $porta = $json->port;  

I just need the two to be in only one variable, for example $ipPort = $json->ip:port . It's just an example, I do not know how to do this so I need your help.

    
asked by anonymous 09.03.2018 / 08:01

1 answer

0

According to your example:

 $proxy = $json->ip;
 $porta = $json->port;  

 $full = $json->ip.":".$json->port;
 echo $full;

result:

  

127.0.0.1:80

    
09.03.2018 / 08:09