Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $a='stringsearch';
- $username = 'username';
- $password = 'password';
- $url = "http://exemplo.meuwebservice:(porta)/paraexemplo/$a";
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_HTTPHEADER, "Accept: application/json" );
- $output = curl_exec($ch);
- $info = curl_getinfo($ch);
- curl_close($ch);
- $obj = json_decode($output);
- $json_output = json_decode($output, true);
- foreach($json_output as $item){
- foreach($item as $dados){
- echo $dados;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement