I am having trouble creating a ForEach loop to get stock prices from the wsdl file. I attached a screenshot of my code and output. Please advise.
Hey you should paste the code, but I made something anyway.
<?php
$url_soap = "url_here";
$client = new SoapClient($url_soap);
$list = array("ibm", "microsoft", "apple", "mcdonald's");
foreach($list as $name){
$price = $client->getQuote($name);
echo strtoupper($name)." ".$price."<br />";
}
You get the price for every item this way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.