Convert PERL to PHP


sub getNetOpsComInfoByXngId  {

  my $xngId = shift;

  my $netOpsComStatusCode = 0;
  my $netOpsComContactResultsBody;
  my $retObj = {};
  $retObj->{Error} = '';

      my $soap = SOAP::Lite
           -> proxy("http://netOpsComWs/NetOpsComService", timeout=>240);

  my $serializer = $soap -> serializer();

  my @query = (
          SOAP::Data->name('xngId' => $xngId));

  my $netOpsComContactResults;
  eval {
   $netOpsComContactResults = $soap->call('getSiteInfoByXngId' => @query);

  if ($@) {
    $retObj->{Error} = "Error encountered while attempting to get netOpsCom info $@";
    return $retObj;
  } else {
     $netOpsComContactResultsBody = $netOpsComContactResults->body;
    if ($$netOpsComContactResultsBody{'Fault'}) {
     $retObj->{Error} = "Web service fault message,$$netOpsComContactResultsBody{'Fault'}{'faultstring'}";
     return $retObj; 


ini_set('max_input_time', -1);

$client = new SoapClient("http://netOpsComWs/NetOpsComService?wsdl");

//$result = $client->getSiteInfoByXngId()->opsTrackerSites;
$array = $client->getSiteInfoByXngId()->opsTrackerSites;

//$xngID = $_GET['xngID'];

foreach ($array as $key => $value) {
    $array = $value;
    $xngID = $_GET['xngID'];
    $call = $value->xngId;
    if($call > 0){
        $xngID = $value;
        echo $xngID->managerName;

but URL doesn’t give me value by xngID.

What do you get in $array?

Try using var_dump($array); before the loop and notice the first line in the loop where $array is reassigned.

Good spot, that can’t help things.

I can dump the data and get result. but I can not get value by xngID. When I dump the data in the webservices xngId=>0, value, but I wanted to change 0 value to specific value which can be start from 0-2000. So my goal is call the other fileds value by xngId=>value. but strange wheb dump the data on xngId field section the value gave me is 0(all arrays). Is there any form of code in php that I could make 0 value turned into different value like 1,2,3 and call the other field value within this 1,2.3. Help will be greatly appreciated!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.