function describe_zipcode($zipcode)
{
    # Get required libraries and declare the target
    include "../util/LIB_http.php";
    include "../util/LIB_parse.php";
    $target = "http://www.schrenk.com/nostarch/webbots/zip_code_form.php";
    # Download the target
    $page = http_get($target, $ref = "");
    # Parse the session hidden tag from the downloaded page
    # <input type="hidden" name="session" value="xxxxxxxxxx">
    $session_tag = return_between($string = $page['FILE'], $start = "<input type=\"hidden\" name=\"session\"", $end = ">", $type = EXCL);
    # Remove the "'s and "value=" text to reveal the session value
    $session_value = str_replace("\"", "", $session_tag);
    $session_value = str_replace("value=", "", $session_value);
    # Submit the form
    $data_array['session'] = $session_value;
    $data_array['zipcode'] = $zipcode;
    $data_array['Submit'] = "Submit";
    $form_result = http_post_form($target, $ref = $target, $data_array);
    $landmark = "Information about " . $zipcode;
    $table_array = parse_array($form_result['FILE'], "<table", "</table>");
    for ($xx = 0; $xx < count($table_array); $xx++) {
        # Parse the table containing the parsing landmark
        if (stristr($table_array[$xx], $landmark)) {
            $ret['CITY'] = return_between($table_array[$xx], "CITY", "</tr>", EXCL);
            $ret['CITY'] = strip_tags($ret['CITY']);
            $ret['STATE'] = return_between($table_array[$xx], "STATE", "</tr>", EXCL);
            $ret['STATE'] = strip_tags($ret['STATE']);
            $ret['COUNTY'] = return_between($table_array[$xx], "COUNTY", "</tr>", EXCL);
            $ret['COUNTY'] = strip_tags($ret['COUNTY']);
            $ret['LATITUDE'] = return_between($table_array[$xx], "LATITUDE", "</tr>", EXCL);
            $ret['LATITUDE'] = strip_tags($ret['LATITUDE']);
            $ret['LONGITUDE'] = return_between($table_array[$xx], "LONGITUDE", "</tr>", EXCL);
            $ret['LONGITUDE'] = strip_tags($ret['LONGITUDE']);
        }
    }
    # Return the parsed data
    return $ret;
}
Esempio n. 2
0
function snapSendFalconEmail($emailtype, $toemailaddress, $emaildata = array())
{
    global $APPCONFIG;
    $emailDet = $APPCONFIG['EMAIL'];
    $fromemail = $emailDet['emailfrom'];
    $apiurl = $emailDet['apiurl'];
    $apikey = $emailDet['apikey'];
    $fromname = $emailDet['fromname'];
    $bccemail = $emailDet['CCEMAILADDRESS'];
    $templateurl = $emailDet[$emailtype]['template'];
    $subject = $emailDet[$emailtype]['subject'];
    $to = $toemailaddress;
    $content = file_get_contents($templateurl);
    foreach ($emaildata as $key => $val) {
        $content = str_replace("[{$key}]", $val, $content);
    }
    $data = array();
    $data['subject'] = rawurlencode($subject);
    $data['fromname'] = rawurlencode($fromname);
    $data['api_key'] = $apikey;
    $data['from'] = $fromemail;
    $data['content'] = rawurlencode($content);
    $data['recipients'] = $to;
    $data['bcc'] = $bccemail;
    $result = http_post_form($apiurl, $data);
    //file_put_contents('/tmp/res',$result);
}
Esempio n. 3
0
    // Timeout
    curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME);
    // Webbot name
    curl_setopt($ch, CURLOPT_URL, $target);
    // Target site
    curl_setopt($ch, CURLOPT_REFERER, $ref);
    // Referer value
    curl_setopt($ch, CURLOPT_VERBOSE, FALSE);
    // Minimize logs
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    // No certificate
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    // Follow redirects
    curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
    // Limit redirections to four
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    // Return in string
    # Create return array
    $return_array['FILE'] = curl_exec($ch);
    $return_array['STATUS'] = curl_getinfo($ch);
    $return_array['ERROR'] = curl_error($ch);
    # Close PHP/CURL handle
    curl_close($ch);
    # Return results
    return $return_array;
}
$target = 'http://www.viper-7.com/test2.php';
$ref = $PHP_SELF;
$data_array['testvalue'] = 'hello';
$contents = http_post_form($target, $ref, $data_array);
echo $contents['FILE'];