Jump to content

A simple question


kosaks

Recommended Posts

Hello to everyone

 

I would like to ask for this simple question.. Im trying to put if and else condition on my php code. However this condition is not working..

 

if($file == #3#){
echo "No results found";
}else{ echo "results has been found"; }

 

This variable $file is the result after i used an API.. If the API does not see any results they would return #3# as the result. This means they returned a transaction code of 3 which you can see here http://developer.textapp.net/WebService/TransactionCodes.aspx means that there was nothing to return.

 

The condition does not function well even if i make 3 or #3# as part of the condition. Can you help me guys?

 

thanks

Link to comment
Share on other sites

Hello..

 

Thanks for your help.. Sadly it does not solve my problem.. I've check the result again on the API and it returned #3# as the result.. However by using the if statement

 

if($file == '#3#'){
echo "No results found";
}else{ echo "results has been found"; }

 

the result is results has been found which is wrong the result should be No results found since my API does not see any result..

 

Does this has something to do with the returned string of my API?

 

thanks

Link to comment
Share on other sites

Hello sir

 

This is actually being returned by the API #3# if it does not see any result. You can check it here http://developer.textapp.net/WebService/Methods_GetSMSInbound.aspx and for the transaction code #3# you can refer it here http://developer.textapp.net/WebService/TransactionCodes.aspx..

 

Dont know why the condition is not working..

 

thanks

Link to comment
Share on other sites

Hello sir.. this is the code..

 

<?php

$sc = new SoapClient('http://www.textapp.net/webservice/service.asmx?wsdl');

$params = new stdClass();

 

$params->returnCSVString = true;

$params->externalLogin = 'SU11202050';

$params->password = 'jpdxcPK2';

$params->number = '+447537404702';

$params->keyword = 'test';

 

$result = $sc->__call('GetSMSInbound', array($params));

$file = $result->GetSMSInboundResult;

 

if($file == '#3#'){

echo "No results found";

}else{ echo "results has been found"; }

 

echo $file;

?>

 

thanks

Link to comment
Share on other sites

Hello sir

 

Sorry if you did not understand my reply. I myself is being puzzled on my work.

When i use the API (Please refer to the API code earlier) it returns this as the output..

 

#1# "4","+447980987654","+447781537583","","2009-07-08","10:38:15","hello "","" world","Green" "5","+447980987654","+44776230146","","2009-07-08","10:38:55","hello world","Green"

 

otherwise if it does have have any output to return.. this is the returned output of the API

 

#3#

 

Im thinking why my condition does not work well.. if i use this code for my condition..

 

if($file == '#3#'){
echo "No results found";
}else{ echo "results has been found"; }

 

Does this makes sense sir? thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.