Read CSV and check webservice

0

Hello, I have a code that reads CSV, see

$meuArray = Array();
$file = fopen('numeros.csv', 'r');
while (($line = fgetcsv($file)) !== false)
{
  $meuArray[] = $line;
}
fclose($file);

I want to get the value of the $ myArray variable and play in front of the 'item' = > of the code below

$arrayItem= array('8532300022', '8501022934', '8501022969', '8501022926', '8501022985'); 

foreach ($arrayItem as $i => $item) { 

//faz a consulta 
$retval = $client->ObterCadastro_S( 
array( 
        'item'  => <--- Eu quero jogar aqui os valor do CSV
     ) 
); 
echo $retval->ObterCadastro_SResult->Titulo. "</br>";
}

Updated code

<?php

$params  = array("soap_version"=> SOAP_1_2,
                "trace"=>1,
                "exceptions"=>0,
                );

$client = @new SoapClient('http://webserviceteste.com.br/WebService/WebService.asmx?WSDL',$params);

 $meuArray = Array();
 $file = fopen('numeros.csv', 'r');
 while (($line = fgetcsv($file)) !== false) {
   $meuArray[] = $line;
 }
 fclose($file);

 foreach($meuArray as $item) {

   //faz a consulta 
   $retval = $client -> ObterCadastro_S(
     array(

       'item'  => $item
     )
   );
   echo $retval -> ObterCadastro_SResult -> Titulo;
 }

?>

Valew

    
asked by anonymous 08.11.2015 / 17:19

1 answer

-1

See if this helps:

 $meuArray = Array();
 $file = fopen('numeros.csv', 'r');
 while (($line = fgetcsv($file)) !== false) {
   $meuArray[] = $line;
 }
 fclose($file);

 foreach($meuArray as $item) {

   //faz a consulta 
   $retval = $client - > ObterCadastro_S(
     array(
       'item' => $item
     )
   );
   echo $retval - > ObterCadastro_SResult - > Titulo.
   "</br>";
 }

And I suggest reading:

link link

By the questions, you seem to be confused about the use of loops.

    
08.11.2015 / 17:25