0

In PHP / HTML I have an iFrame which displays contents from an external website (not my own). Basically I need to be able to only have that iFrame displayed if it doesn't contain the words "No Details Found". Is this possible?

echo '<li><iframe src="http://web.site.co.uk/wrd/run/wt_xtest_pw.cb_cgi?cb_dialogue=detailSearch&MyRef=$_GET[useforminput]&contactNo=0123456789" width="188" height="258" scrolling="no" style="overflow:hidden; margin-top:-4px; margin-left:-4px; border:none;"></iframe></li>';

Where $_GET[useforminput] is the variable (I assume that bit's fine, even with quotes, etc.)

So I need that iFrame to not display if it contains "No Details Found". It's a bit of a useless API from a company who doesn't appear to like XML very much..

1 Answer 1

1
$var = file_get_contents('http://web.site.co.uk/wrd/run/wt_xtest_pw.cb_cgi?cb_dialogue=detailSearch&MyRef='.$_GET['useforminput'].'&contactNo=0123456789');

if( strpos($var, 'No Details Found') === false ) {

    // not found, display
} else {

    // found, do something else
}
Sign up to request clarification or add additional context in comments.

1 Comment

Wow! That was simpler than expected! Thanks, I shall make lots of use of this today :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.