API call switching webform2 to webform3
Posted: Fri Dec 15, 2017 10:03 am
Strange I know, that's why I'm posting
Scenario:
We have inbound calls coming from postcards that were sent out.
When the call comes in, the reps hit webform(1) and that opens a search php file here
that's a simple search box which uses the postcard claim number for the search, which bring the reps to this
now... the <a href api link does what it's suppose to do, it auto populates all the information into the correct fields in vici, but when the rep hits the link, webform2 changes to webform3 and doesn't work right... any idea what could be causing this?
Scenario:
We have inbound calls coming from postcards that were sent out.
When the call comes in, the reps hit webform(1) and that opens a search php file here
- Code: Select all
<head>
<title>Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<form action="searchmail.php" method="GET">
<input type="text" name="query" />
<input type="hidden" name="user" value=<?php echo $_GET['user'] ?> />
<input type="submit" value="Search" />
</form>
</body>
</html>
that's a simple search box which uses the postcard claim number for the search, which bring the reps to this
- Code: Select all
<?php
$servername="localhost";
$username="cron";
$password="1234";
$dbname="asterisk";
$user = $_GET['user'];
$conn=new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query1 = "SELECT * from vicidial_closer_log where user = '$user' and status = 'INCALL';";
$result=$conn->query($query1);
/* This will loop through all the rows until it reaches the end */
while ($row = $result->fetch_assoc()) {
if ($row['user'] == ($user)) $phone_number['phone_number'] = $row['phone_number'];
}
$search1 = array();
$ch = fopen("MU_06.23_mail data.csv", "r");
$header_row = fgetcsv($ch);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch1 = fopen("MU_08.18_mail data.csv", "r");
$header_row = fgetcsv($ch1);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch1)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch2 = fopen("MU_08.25_mail data.csv", "r");
$header_row = fgetcsv($ch2);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch2)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch3 = fopen("MU_09.01_mail data.csv", "r");
$header_row = fgetcsv($ch3);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch3)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch4 = fopen("MU_09.08_mail data.csv", "r");
$header_row = fgetcsv($ch4);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch4)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch5 = fopen("MU_09.15_mail data.csv", "r");
$header_row = fgetcsv($ch5);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch5)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch6 = fopen("MU_10.20_mail data.csv", "r");
$header_row = fgetcsv($ch6);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch6)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch7 = fopen("MU_10.27_mail data.csv", "r");
$header_row = fgetcsv($ch7);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch7)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch8 = fopen("MU_11.03_mail data.csv", "r");
$header_row = fgetcsv($ch8);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch8)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch9 = fopen("MU_11.10_mail data.csv", "r");
$header_row = fgetcsv($ch9);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch9)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch10 = fopen("MU_11.24_mail data.csv", "r");
$header_row = fgetcsv($ch10);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch10)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch11 = fopen("MU_12.01_mail data.csv", "r");
$header_row = fgetcsv($ch11);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch11)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$ch12 = fopen("MU_12.08_mail data.csv", "r");
$header_row = fgetcsv($ch12);
/* This will loop through all the rows until it reaches the end */
while($row = fgetcsv($ch12)) {
if (in_array($_GET['query'], $row)) {
echo '<div>' . implode(' | ', $row) . ' </div>';
$search1[] = array_combine ($header_row, $row);
$query = $_GET['query'];
$file = fopen('mail.txt', "a");
$file1 = fopen('mailwnumbers.txt', "a");
fwrite($file, $query."\n");
fwrite($file1, "" . $query . ", " . $phone_number['phone_number'] . "\n");
fclose($fd);
}
}
$first_name = $search1[0]['FIRST NAME'];
$last_name= $search1[0]['LAST NAME'];
$address1= $search1[0]['PRIMARY ADDRESS'];
$city= $search1[0]['CITY'];
$state= $search1[0]['ST'];
$postal_code = $search1[0]['ZIP'];
$gender = $search1[0]['GENDER'];
$middle_initial = $search1[0]['MI'];
$claim_number = $search1[0]['FINDER NUM'];
?>
<a href='http://SERVERIP/agc/api.php?source=test&user=6666&pass=VICIPASS&function=update_fields&agent_user=<?php echo $user; ?>&first_name=<?php echo $first_name; ?>&last_name=<?php echo $last_name; ?>&address1=<?php echo $address1; ?>&city=<?php echo $city; ?>&state=<?php echo $state; ?>&postal_code=<?php echo $postal_code; ?>&gender=<?php echo $gender; ?>&middle_initial=<?php echo $middle_initial; ?>&address3=<?php echo $claim_number; ?>' id="vicipop"><div><font size=5>Auto-Populate Vicidial Screen</font></div></a>
now... the <a href api link does what it's suppose to do, it auto populates all the information into the correct fields in vici, but when the rep hits the link, webform2 changes to webform3 and doesn't work right... any idea what could be causing this?