How to send information by local POST to external server?

0

I'm developing an application that needs to be on a local server and I need to send some information to an external server, what should I do?

    
asked by anonymous 21.11.2016 / 01:10

1 answer

0

To make a post to an external server, use curl:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,            'http://www.exemplo.com.br');
curl_setopt($ch, CURLOPT_POSTFIELDS,     http_build_query(array('login' => 'abc', 'senha' => '1234')));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST,           true);

$consulta = curl_exec($ch);
curl_close($ch);
    
22.11.2016 / 19:13