I've looked for numerous examples on StackOverflow so that this question would not be redundant. I haven't seen an answer that has worked for my situation. Thanks in advance!!
I created an auto response script used to respond to incoming leads for a construction business. The inbound lead data is listed in within an HTML document (internal web page). Because off various agreements with other companies, there are some cities that they cannot bid on jobs for in our area.
This is the code I've used to successfully check for the instance of one city in the $page ($page being the html page):
<?php
$flag == false;
//checks for cities we do not serve//
if(strpos($page, 'Lakeland') !== false){
$flag == true;
}
if($price != 0 && $flag == false){
// SENDS QUOTE
if(strpos($page, '"success":true')){
echo "Status: SENT QUOTE" . PHP_EOL;
?>
What I really need to do is have it check for more than just one city (e.g. Lakeland or Zephryhills or Tarpon Springs, etc) if ANY of these cities are listed on the page, $flag == true; and stops submitting the quote. I've tried the following with no avail....with this code it inputs the message but will not submit an auto-response to any leads:
<?php
$flag == false;
if (strpos($page, 'Lakeland') !== false || strpos($page, 'Zephryhills') !== false || strpos($page, 'Tarpon Springs') !== false){
$flag == true;
if($price != 0 && $flag == false){
// SENDS QUOTE
if(strpos($page, '"success":true')){
echo "Status: SENT QUOTE" . PHP_EOL;
?>
@Vishwa So, an array like this, followed by your code?
$cities = array('Lakeland', 'Zephyrhills', 'Tarpon Springs');
If you can put that list of cities in an array (I assume, you could) , this function might help you.
Now, you can just use