westminster86 Posted March 11, 2008 Share Posted March 11, 2008 $soap = new SoapClient('http://'); // wsdl code shows where the SOAP server code is expected to be found try { $avalue = $soap->getinfo(); // call the getinfo method in the soap object } catch (SoapFault $ex) { echo $ex->faultstring; } print $avalue; Im reading in a text string via a SOAP sever called from a client. So in the above $avalue holds the text string from the getinfo function declared in the SOAP server. My question is, how would i get round reading in data from other SOAP services? So, for example after reading in $avalue, i get data from $soap = new SoapClient('http://This time round a different directory'); Should i be using a loop of some sort, so that after its read in the text string from one directory it fetches in another from a different SOAP server. Quote Link to comment Share on other sites More sharing options...
westminster86 Posted March 11, 2008 Author Share Posted March 11, 2008 Maybe this is clearer... $variable = 'Please'; $variable = 'help'; $variable = 'me'; echo $variable; The echo statement is only going to print out me. What i want is for it to read in please first, and then go back round the loop and then read in help and so forth. Quote Link to comment Share on other sites More sharing options...
westminster86 Posted March 12, 2008 Author Share Posted March 12, 2008 I have two variables. $variable = 'hello'; $variable = 'bye'; How would i write a loop that reads in the first variable(hello), does something with the variable, then comes back round the loop and reads in the second variable(bye). Quote Link to comment Share on other sites More sharing options...
trq Posted March 12, 2008 Share Posted March 12, 2008 How would i write a loop that reads in the first variable(hello), does something with the variable, then comes back round the loop and reads in the second variable(bye). <?php $variable1 = 'hello'; $variable2 = 'bye'; $arr = array($variable1,$variable2); foreach ($arr as $v) { // do something. echo $v; } ?> Quote Link to comment Share on other sites More sharing options...
westminster86 Posted March 12, 2008 Author Share Posted March 12, 2008 What happens if theres a third variable added, im going to have to add it to the array. I need a loop of some sort that reads in the variables but does not neccessarily know how many variables there are. Quote Link to comment Share on other sites More sharing options...
conker87 Posted March 12, 2008 Share Posted March 12, 2008 $variable = 'Please'; $variable .= 'help'; $variable .= 'me'; echo $variable; Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 12, 2008 Share Posted March 12, 2008 That's not what the OP is looking for. If you don't know how many variables you are going to have, start with an empty array and add to it as you get the values: <?php $ar = array(); $ar[] = 'some value';; $ar[] = getanotherval(); $ar[] = 'some other value'; // // process // foreach($ar as $val) { // // do something // }?> Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.