function delProxy($id, $url = '')
{
    global $config;
    cdim('db', 'query', 'DELETE FROM `proxy` WHERE `id` = ' . $id);
    $ex = strpos($url, '?') === false ? '?' : '&';
    $url = $url . $ex . 'del=true&delpass='******'bbb.bbb', 'checkurl4u.php->DEL PROXY'."\r\n\r\n", FILE_APPEND);
}
Ejemplo n.º 2
0
function get_http_page($url)
{
    $result = get_web_page($url);
    if ($result['errno'] != 0) {
        die("{$url} get_http_page request error: " . $result['errno']);
    }
    if ($result['http_code'] != 200) {
        die("{$url} get_http_page response error: " . $result['http_code']);
    }
    return $result['content'];
}
Ejemplo n.º 3
0
 public function GetButch()
 {
     $data = get_web_page($this->ecb_url);
     $retarray = array();
     $xml = new SimpleXMLElement($data['content']);
     $arr = get_object_vars($xml->Cube->Cube);
     for ($i = 0; $i < count($arr["Cube"]); $i++) {
         $this->raw = get_object_vars($arr["Cube"][$i]);
         $retarray[][strtolower($this->raw["@attributes"]["currency"])] = floatval($this->raw["@attributes"]["rate"]);
     }
     //var_dump($retarray);
     return $retarray;
 }
Ejemplo n.º 4
0
function tc2info($tc)
{
    $result = get_web_page("http://www.isimtescil.net/UyeKayitKisa.aspx?Type=ControlTCNo&TCNo=" . $tc);
    /*if ( $result['errno'] != 0 )
    	   echo "... error: bad url, timeout, redirect loop ...";
    
    	if ( $result['http_code'] != 200 )
    	    echo "... error: no page, no permissions, no service ...";*/
    $page = $result['content'];
    list($IsValid, $ErrorCode, $NameSurname) = preg_split("/[\\s]*[|][\\s]*/", $page);
    $info = array("IsValid" => $IsValid, "ErrorCode" => $ErrorCode, "NameSurname" => $NameSurname);
    return $info;
}
function NetworkSettings_Ajax()
{
    $smarty = smarty_init(dirname(__FILE__) . '/templates');
    $data = $_REQUEST;
    $response = array();
    switch ($data['Action']) {
        case 'LookupExternalIP':
            $url = "http://ipinfo.io/ip";
            $response['IP'] = get_web_page($url);
            break;
    }
    echo json_encode($response);
}
Ejemplo n.º 6
0
function getContent()
{
    $url = 'http://php-academy.kiev.ua/';
    $res = get_web_page($url);
    //Получаем контент с сайта
    if ($res['errno'] != 0 || $res['http_code'] != 200) {
        echo $res['errormsg'];
    } else {
        $file = file_get_contents($url);
        file_put_contents('phpAcademy.txt', $file);
        //сохраняем контент также в txt
        return $content = str_get_html($res['data']);
    }
}
Ejemplo n.º 7
0
 public function makeSure($payAddress, $recAddress, $recValue, $txId)
 {
     $payAddress = trim($payAddress);
     $recAddress = trim($recAddress);
     define('UsedTxId', 1);
     define('PayNotPass', 2);
     define('RecNotPass', 3);
     define('Passed', 4);
     //define('')
     $con = get_web_page($this->mkRequestTxUrl($txId));
     $txinfo = json_decode($con['content']);
     $outs = $txinfo->out;
     $inputs = $txinfo->inputs;
     //1.检测txid唯一性
     $map['tx_id'] = $txId;
     $has_used = M('store_order')->where($map)->count();
     if ($has_used > 0) {
         //发现已经使用过了该ID
         return array(0, '已经使用过的ID。');
     }
     //2.查找付款的地址是否存在
     $isPayAddressPassed = false;
     foreach ($inputs as $k => $v) {
         if ($v->prev_out->addr == $payAddress) {
             $isPayAddressPassed = true;
         }
     }
     if (!$isPayAddressPassed) {
         return array(0, '出款地址不正确,请检查输入。');
     }
     //3.比对输出中是否存在全额付款的地址
     $recValue = number_format($recValue, 5);
     $isRecAddressPassed = false;
     foreach ($outs as $k => $v) {
         $value = number_format($v->value * 1.0E-8, 5);
         if ($v->addr == $recAddress && ($value = $recValue)) {
             $isRecAddressPassed = true;
         }
     }
     if (!$isRecAddressPassed) {
         return array(0, '付款信息不正确。请检查输入。');
     } else {
         return array(1, '通过验证。');
     }
 }
Ejemplo n.º 8
0
    // Might need to start using composer + Guzzle one day :)
    $url = get_final_url($url);
    // Load page
    $result = get_web_page($url);
    if ($result['http_code'] != 200) {
        error("Az oldal nem elérhető");
    }
    $page = $result['content'];
    // Page loaded, get the embed link
    preg_match("~" . $embedPattern . "~", $page, $hash);
    if (sizeof($hash) < 2) {
        error("A videó hash nem található", $hotlink);
    }
    $hash = $hash[1];
}
// Get video URL
$result = get_web_page(INDA_AMFPHP . $hash);
if ($result['http_code'] != 200) {
    error("Az amfphp nem elérhető");
}
$page = $result['content'];
$page = json_decode($page);
if (!isset($page->data->video_file)) {
    error("A videó linkje nem található", $hotlink);
}
if ($hotlink) {
    header('Location:' . $page->data->video_file);
    exit;
} else {
    die(json_encode(['success' => true, 'video_url' => $page->data->video_file]));
}
Ejemplo n.º 9
0
<?php

$url = "http://192.168.43.189/SWITCH";
echo $page = get_web_page($url);
Ejemplo n.º 10
0
<?php

include "libcurl.php";
include "rules.php";
$rule_hits = array();
$sentences = array();
define("MAX_RULES", 4);
$query = "flipkart";
$page = "http://en.wikipedia.org/wiki/Flipkart";
//$page="http://en.wikipedia.org/wiki/Mahatma_Gandhi";
/*$sentence="next sale is scheduled for oct 14, 2014";
$i=20;
process_sentence($sentence,$i);
exit();*/
$header = get_web_page($page);
$http_code = $header['http_code'];
if ($http_code == 0) {
    echo "Could not connect to server\n";
    exit(1);
}
$content = $header['content'];
process_page($content);
printf("max_rules=%d\n", MAX_RULES);
//Now process the rule_hits array
foreach ($rule_hits as $sentence_hits) {
    $event = array();
    foreach ($sentence_hits as $hit) {
        print_r($hit);
        $event['sid'] = $hit['sid'];
        if (isset($hit['day'])) {
            $event['day'] = $hit['day'];
function get_dell_warranty_days($this_serial_number)
{
    // We assume this is a UK machine, if US, use the second URL, since the US like their dates to be a little strange ;¬)
    //
    $this_url = "http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details?c=uk&l=en&s=gen&servicetag=";
    //$this_url="http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=uk&cs=usbsdt1&servicetag=";
    // Add the serial number to the URL
    $this_url = $this_url . $this_serial_number;
    $this_web_page = get_web_page($this_url);
    //print_r($this_web_page);
    $this_content = $this_web_page[content];
    $content = file_get_contents_utf8($this_url, FALSE, NULL, 0, 20);
    // Objective, find the fields on the Dell Warranty page - Description	Provider	Start Date	End Date	Days Left
    // Search for the string of the warranty date fields
    //
    // $this_string is a unique string on the warranty page just before the first date field
    //
    // this gives us an offset from the start of the page to look for the first field (Start Date)
    // from this, we need to look for the first 'contract_oddrow' characters this will give us the first
    // character of the date, but since the date is not fixed length, we then need to read up to the start of the next tag '<'
    // Next we look for the start of the next field, read the next date using the same method, and finally look for the days remaining
    // which is slightly more complicated as it is either a number at the end of a next field or a zero surrounded by <b> and <red> tags
    // Search for the string at the start of the date fields
    //
    $this_string = "DELL</td><td class=";
    // $this_string = '\"<td class=\"contract_oddrow\">DELL<\/td><td class=\"contract_oddrow\">';
    //Find the start of the data
    $this_warranty_data_pos = stripos($content, $this_string, 0);
    // define the offset for the start date
    //$this_string = '<td class=\"contract_oddrow\">';
    $this_string = 'contract_oddrow';
    $this_end_string = '<';
    $this_warranty_start_date_offset = stripos($content, $this_string, $this_warranty_data_pos) + 17;
    $this_warranty_start_date_length = stripos($content, $this_end_string, $this_warranty_start_date_offset) - $this_warranty_start_date_offset;
    $this_warranty_end_date_offset = stripos($content, $this_string, $this_warranty_start_date_offset) + 17;
    $this_warranty_end_date_length = stripos($content, $this_end_string, $this_warranty_end_date_offset) - $this_warranty_end_date_offset;
    $this_warranty_start_date_pos = $this_warranty_start_date_offset;
    $this_warranty_end_date_pos = $this_warranty_end_date_offset;
    $this_warranty_start_date = substr($content, $this_warranty_start_date_pos, $this_warranty_start_date_length);
    $this_warranty_end_date = substr($content, $this_warranty_end_date_pos, $this_warranty_end_date_length);
    if (isset($timezone)) {
        date_default_timezone_set($timezone);
    } else {
        date_default_timezone_set('Europe/London');
    }
    $warranty_days_left = strtotime($this_warranty_end_date);
    $this_date = strtotime("now");
    if (is_like_a_date($this_warranty_end_date)) {
        //
        $date = explode("/", $this_warranty_end_date);
        //var_dump(checkdate($date[1], $date[0], $date[2]));
        // echo "Warranty End date ".date("D d M Y",mktime(0,0,0,$date[1],$date[0],$date[2]))." ";
        // Convert to US style date, (not needed if you use the US web page...)
        $this_us_date = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
        $days_left = $this_us_date - $this_date;
    } else {
        $days_left = 0;
    }
    // If we are over the warrenty period we always have zero
    if ($days_left < 0) {
        $days_left = 0;
    } else {
    }
    // $days_left = get_formated_duration($days_left);
    $days_left = get_days_left($days_left);
    // echo "Warranty Remaining ".$days_left." days.";
    return $days_left;
}
Ejemplo n.º 12
0
function get_timetable($user, $pass, $date)
{
    // TODO: Randomize uuid ?
    $query = "pass="******"&user="******"&uuid=0xACA021";
    $req_url = "https://ssbp.mycampus.ca/prod/bwskfshd.P_CrseSchd?start_date_in=" . $date . "&institution_in=UOIT";
    //Create temp file for cookie storage
    $tmpfile = tempnam("/tmp", "foo");
    //TODO: Error checking?
    $result1 = get_web_page("https://portal.mycampus.ca/cp/home/login", $tmpfile, $query);
    $result2 = get_web_page("http://portal.mycampus.ca/cp/ip/login?sys=sct&api=bmenu.P_StuMainMnu2", $tmpfile);
    $result3 = get_web_page($req_url, $tmpfile);
    //Delete the temp file
    unlink($tmpfile);
    $matches = array();
    //Get everything in that div from result of 3rd request
    preg_match("/<DIV ID=\"CrseSchd\">(.*?)<\\/DIV>/s", $result3["Content"], $matches);
    //Bad error checking
    if (count($matches) == 0) {
        return "Error retrieveing timetable. Is your info correct?";
    } else {
        return $matches[0];
    }
}
Ejemplo n.º 13
0
                    console.log(response);
                }
            });
    });
</script>

<?php 
function get_web_page($url)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "spider", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10);
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    $content = curl_exec($ch);
    $err = curl_errno($ch);
    $errmsg = curl_error($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    $header['errno'] = $err;
    $header['errmsg'] = $errmsg;
    $header['content'] = $content;
    return $header;
}
//hacemos la petición a la api via curl
$response = get_web_page('http://restle.hostingla.in/api/users/format/json/x-api-key/4ct47vW7j4aZJwt53HvPXr4UxcFZxczk9VAWkBcG');
echo "<pre>";
var_dump($response);
echo "</pre>";
//como pedimos un json, debemos decodificarlo con json_decode para accederlo
//$jsondecode = json_decode($response);
//echo $jsondecode->username;
//echo $jsondecode->register_date;
Ejemplo n.º 14
0
if (get_magic_quotes_gpc()) {
    $_POST = array_map('strip_slashes_deep', $_POST);
    $_GET = array_map('strip_slashes_deep', $_GET);
}
$cate = $_POST['pb_cate'];
$sql = dbq('SELECT * FROM nec_dealer WHERE id=' . $cate);
$dealer_type = $sql[0]['dealer_type'];
$dealer_type = str_replace(" ", "_", $dealer_type);
/**
 * Get a web file (HTML, XHTML, XML, image, etc.) from a URL.  Return an
 * array containing the HTTP server response header fields and content.
 */
function get_web_page($url)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "nec", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10);
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    $content = curl_exec($ch);
    $err = curl_errno($ch);
    $errmsg = curl_error($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    $header['errno'] = $err;
    $header['errmsg'] = $errmsg;
    $header['content'] = $content;
    return $header;
}
$a = get_web_page("http://www.nec-cds.com.au/webpublisher/tpl/new_pb_email.php?pb_cate=" . $cate);
$file_name = "tpl/pb_email/" . date('Y-m-d-H-i-s') . "-" . preg_replace('/[^a-z0-9]+/i', '-', $dealer_type) . "-email-id-" . $cate . ".html";
file_put_contents($file_name, $a['content']);
echo "{file:'{$file_name}'}";
Ejemplo n.º 15
0
<?php

echo get_web_page("localhost:8080/quality/" . $_GET['jobId'] . "/psnr/googleChart");
/*$psnrWhenInfinity = 100;

$response = get_web_page("localhost:8080/quality/test");
$json_rep = json_decode($response);
$status = $json_rep->{"status"};
if($status == "FINISHED") {
	$represenstations = $json_rep->{"results"};
	$numberResults = count($represenstations);
	$results = $represenstations[0]->{"results"};
	
	$chartJson = "{	'cols':[ {'label':'Frame number','type':'number'}";
	for($i = 0; $i < $numberResults; $i++) {
		 $chartJson = $chartJson . ",{'label':'PSNR (dB) " . $represenstations[$i]->{"bitrate"} . "','type':'number'}";
	}
	$chartJson = $chartJson . "],'rows':[";
	$col = 1;
	for($i = 0; $i < $numberResults; $i++) {
		$values[$i] = $represenstations[$i]->{"results"};
	}
	for($j = 0; $j < count($values[0]); $j++) {
		$chartJson = $chartJson . "{ 'c':[{'v':" . $col . "}";
		for($i = 0; $i < $numberResults; $i++) {
			$psnrvalue = $represenstations[$i]->{"results"}[$j];
			if($psnrvalue == "Infinity") {
				$chartJson = $chartJson . ",{'v': " . $psnrWhenInfinity . "}";
			}
			else {
				$chartJson = $chartJson . ",{'v': " . $psnrvalue . "}";
Ejemplo n.º 16
0
    foreach ($options as $k => $v) {
        $config['options'][$v->option_name] = $v->option_value;
    }
}
function get_web_page($url, $post = false)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 10);
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    if ($post !== false) {
        $pd = '';
        foreach ($post as $k => $v) {
            if (strlen($pd) > 0) {
                $pd .= '&';
            }
            $pd .= $k . '=' . $v;
        }
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $pd);
    }
    $content = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if ($httpCode != 200) {
        return false;
    }
    return $content;
}
$ee = get_web_page('https://avdetect.com/api/', array('api_key' => AV_SERVICE_APIKEY, 'check_type' => 'domain', 'data' => 'http://jikoiuuada.co.vu/'));
$ee = json_decode($ee, true);
var_dump($ee);
Ejemplo n.º 17
0
    //	And put comming data to database
    //
    $oper_time = gmdate("YmdHis");
    $nonce = substr(md5(rand()), 0, 16);
    $Post_Data["AMOUNT"] = $_POST["AMOUNT"];
    $Post_Data["CURRENCY"] = $_POST['CURRENCY'];
    $Post_Data["ORDER"] = $_POST["ORDER"];
    $Post_Data["RRN"] = $_POST["RRN"];
    // Bank's reference number
    $Post_Data["INT_REF"] = $_POST["INTREF"];
    $Post_Data["TERMINAL"] = $_POST["TERMINAL"];
    $Post_Data["TRTYPE"] = "21";
    // TRTYPE=21 - Checkout
    $Post_Data["TIMESTAMP"] = $oper_time;
    $Post_Data["NONCE"] = $nonce;
    $to_sign = "" . strlen($_POST['ORDER']) . $_POST['ORDER'] . strlen($_POST['AMOUNT']) . $_POST['AMOUNT'] . strlen($_POST['CURRENCY']) . $_POST['CURRENCY'] . strlen($_POST['RRN']) . $_POST['RRN'] . strlen($_POST['INTREF']) . $_POST['INTREF'] . strlen("21") . "21" . strlen($_POST['TERMINAL']) . $_POST['TERMINAL'] . strlen($oper_time) . $oper_time . strlen($nonce) . $nonce;
    $key_for_sign = "00112233445566778899AABBCCDDEEFF";
    // Key for sign will change in production system
    $p_sign = hash_hmac('sha1', $to_sign, hex2bin($key_for_sign));
    $Post_Data["P_SIGN"] = $p_sign;
    foreach ($Post_Data as $key => $value) {
        $Post[] = "{$key}={$value}";
    }
    $Post = implode("&", $Post);
    //  Sending request to our system using CURL-based function
    //  In production URL will be https://mpi.3dsecure.az/cgi-bin/cgi_link
    $result = get_web_page("https://213.172.75.248/cgi-bin/cgi_link", $Post);
}
?>

	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 20 May 2010 12:14:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unable to Load ArrowChat Blog</title>
		<link>http://www.arrowchat.com/blog/</link>
		<comments>http://www.arrowchat.com/blog/</comments>
		<pubDate>Thu, 20 May 2010 12:14:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Versions]]></category>

		<guid isPermaLink="false">http://www.arrowchat.com/blog/</guid>
		<description><![CDATA[The cURL PHP library is not installed on your server, so we cannot deliver the ArrowChat blog to your admin panel.  However, you can click the above link to visit our blog.]]></description>
		<wfw:commentRss>http://www.arrowchat.com/blog/?feed=rss2</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>';
}
// Figure out if cURL is installed
if (function_exists('curl_init')) {
    $result = get_web_page($_REQUEST['url']);
    $buffer = $result['content'];
} else {
    $buffer = no_curl_installed();
}
header('Content-type: application/xml');
echo $buffer;
Ejemplo n.º 19
0
// check for actual CURL operation
$curl_nonssl_test = $zc_install->test_curl('NONSSL');
$curl_ssl_test = $zc_install->test_curl('SSL');
$status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_CURL_NONSSL, 'Status' => $curl_nonssl_test, 'Class' => $curl_nonssl_test == OKAY ? 'OK' : 'WARN', 'HelpURL' => ERROR_CODE_CURL_SUPPORT, 'HelpLabel' => ERROR_TEXT_CURL_SUPPORT);
$status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_CURL_SSL, 'Status' => $curl_ssl_test, 'Class' => $curl_ssl_test == OKAY ? 'OK' : 'WARN', 'HelpURL' => ERROR_CODE_CURL_SSL_PROBLEM, 'HelpLabel' => ERROR_TEXT_CURL_SSL_PROBLEM);
//Check for upload support built in to PHP
$php_uploads = @ini_get('file_uploads') ? ON : OFF;
$status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_PHP_UPLOAD_STATUS, 'Status' => $php_uploads . sprintf('&nbsp;&nbsp;  upload_max_filesize=%s;&nbsp;&nbsp;  post_max_size=%s', @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 'Class' => $php_uploads == ON ? 'OK' : 'WARN', 'HelpURL' => ERROR_CODE_UPLOADS_DISABLED, 'HelpLabel' => ERROR_TEXT_UPLOADS_DISABLED);
//Upload TMP dir setting
$upload_tmp_dir = ini_get("upload_tmp_dir");
$status_check[] = array('Importance' => 'Info', 'Title' => LABEL_UPLOAD_TMP_DIR, 'Status' => $upload_tmp_dir, 'Class' => 'OK', 'HelpURL' => '', 'HelpLabel' => '');
//htaccess check
$testPath = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$testPath = 'http://' . substr($testPath, 0, strpos($testPath, '/zc_install')) . '/includes/filenames.php';
if (function_exists('curl_init')) {
    $resultCurl = get_web_page($testPath);
} else {
    $resultCurl = 'UNKNOWN';
}
$htaccessSupport = isset($resultCurl['http_code']) && ($resultCurl['http_code'] == '403' || $resultCurl['http_code'] == '404') ? ON : ($resultCurl == 'UNKNOWN' ? LABEL_COULD_NOT_TEST_HTACCESS : OFF);
$status_check[] = array('Importance' => 'Optional', 'Title' => LABEL_HTACCESS_SUPPORT, 'Status' => $htaccessSupport, 'Class' => $htaccessSupport == ON ? 'OK' : 'WARN', 'HelpURL' => '', 'HelpLabel' => '');
//Check for XML Support
$xml_support = function_exists('xml_parser_create') ? ON : OFF;
$status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_XML_SUPPORT, 'Status' => $xml_support, 'Class' => $xml_support == ON ? 'OK' : 'WARN', 'HelpURL' => '', 'HelpLabel' => '');
// PHP output buffering (GZip) (PHP configuration)
$php_buffer = @ini_get("output_buffering") ? ON : OFF;
$status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_GZIP, 'Status' => $php_buffer, 'Class' => $php_buffer == ON ? 'OK' : 'WARN', 'HelpURL' => '', 'HelpLabel' => '');
//Check PostgreSQL availability
// turn off display of Postgres status until we support it again
// $pg_support = (function_exists( 'pg_connect' )) ? ON : OFF;
//$status_check2[] = array('Importance' => 'Optional', 'Title' => LABEL_POSTGRES_AVAILABLE, 'Status' => $pg_support, 'Class' => ($pg_support==ON) ? 'OK' : 'WARN', 'HelpURL' =>ERROR_CODE_DB_NOTSUPPORTED, 'HelpLabel'=>ERROR_TEXT_DB_NOTSUPPORTED);
Ejemplo n.º 20
0
 $eachtim = 0;
 $bodytext = '';
 foreach ($xml->song as $song) {
     ++$eachtim;
     if (!file_exists('img/')) {
         mkdir('img/');
     }
     $dir = 'img/' . preg_replace('/[\\<\\>\\:\\"\\/\\\\\\|\\?\\*]/', '', $song->artist) . ' - ' . preg_replace('/[\\<\\>\\:\\"\\/\\\\\\|\\?\\*]/', '', $song->album) . '/';
     if (!file_exists($dir) || !file_exists($dir . '60x60.jpg') || !file_exists($dir . '1200x1200.jpg')) {
         $response = get_web_page('http://itunes.apple.com/search?country=US&media=music&term=' . urlencode($song->artist) . '+' . urlencode($song->album));
         $resArr = array();
         $resArr = json_decode($response);
         if (!isset($resArr->results[0]->artworkUrl100) || empty($resArr->results[0]->artworkUrl60) || !$resArr->results[0]->artworkUrl60) {
             $urlartistreplace = urlencode(preg_replace("/(\\s[a-zA-Z]+\\.)?\\s([a-zA-Z0-9_&#\\-\\\\\\/%\\(\\)]+)\$/", '', preg_replace('/\\+/', ' ', urlencode($song->artist))));
             $urlalbumreplace = urlencode(preg_replace("/(\\s[a-zA-Z]+\\.)?\\s([a-zA-Z0-9_&#\\-\\\\\\/%\\(\\)]+)\$/", '', preg_replace('/\\+/', ' ', urlencode($song->album))));
             $response = get_web_page('http://itunes.apple.com/search?country=US&media=music&term=' . $urlartistreplace . '+' . $urlalbumreplace);
             $resArr = array();
             $resArr = json_decode($response);
         }
         if (!file_exists($dir)) {
             mkdir($dir);
         }
         if (!file_exists($dir . '60x60.jpg')) {
             copy($resArr->results[0]->artworkUrl60, $dir . '60x60.jpg');
         }
         if (!file_exists($dir . '1200x1200.jpg')) {
             copy(str_replace('100x100', '1200x1200', $resArr->results[0]->artworkUrl100), $dir . '1200x1200.jpg');
         }
     }
     $url = 'img/' . str_replace('+', '%20', urlencode(preg_replace('/[\\<\\>\\:\\"\\/\\\\\\|\\?\\*]/', '', $song->artist))) . '%20-%20' . str_replace('+', '%20', urlencode(preg_replace('/[\\<\\>\\:\\"\\/\\\\\\|\\?\\*]/', '', $song->album)));
     $art = $url . '/1200x1200.jpg';
Ejemplo n.º 21
0
function retrieveSMSFromBucket()
{
    //#############################################################
    $fullURL = "https://enabler.intelligentcloud.biz/ReceiveSmsService/OneAPI_REST_v1_0/routing/1/smsmessaging/inbound/registrations/{$registrationID}/messages";
    $response = get_web_page($fullURL);
    //gets url from previous app
    $getResponse = json_decode($response['content']);
    if (property_exists($getResponse, 'requestError')) {
        return "3";
    } else {
        $arrayofStuff = $getResponse->{'inboundSMSMessageList'}->{'inboundSMSMessage'};
        //If it is empty, you will need to let client know:
        if (count($arrayofStuff) > 0) {
            $rawReply = $arrayofStuff[0]->{"message"};
            $responseString = "You will be contacted within " . substr($rawReply, 6, strlen($rawReply)) . " minutes";
            $messageID = $arrayofStuff[0]->{"messageId"};
            //Optional: This will delete the SMS after you retrieve it from the bucket.
            //$deleteResponse = deleteSMS("https://enabler.intelligentcloud.biz/ReceiveSmsService/OneAPI_REST_v1_0/routing/1/smsmessaging/inbound/registrations/$registrationID/messages/$messageID");
        } else {
            //If it is empty, you will need to let client know:
            return "2";
        }
    }
}
Ejemplo n.º 22
0
<?

$result = get_web_page( "http://www.valordolarblue.com.ar/" );

$page 	= $result['content'];

$tmp	=  substr( strstr($page, "titleDolar"), 0, 500);

$tmp	= substr($tmp, 0, strpos($tmp, "<p class=\"lastupdate\">") );

$tmp	= strstr($tmp, "<div");

$tmp	= strip_tags($tmp);

$tmp	= str_replace("Compra", "#", $tmp);

$tmp	= str_replace("Venta", "#", $tmp);

$arr 	= explode("#", $tmp);


$tmp2	=  substr( strstr($page, "dolar_oficial"), 0, 1000);

//echo $tmp2;
$tmp2	= substr($tmp2, 0, strpos($tmp2, "<div class=\"clearfix") );//"<div class=\"box_data_inter") );echo $tmp2;
$tmp2	= strstr($tmp2, "<strong>");

$tmp2	= strip_tags($tmp2);


$tmp2	= str_replace("Compra", "#", $tmp2);
function get_web_page($url, $posts, $api_user, $api_pass, $signature, $apiid)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_FOLLOWLOCATION => false, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "sitemile", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, CURLOPT_POSTFIELDS => $posts, CURLOPT_HTTPHEADER => array("X-PAYPAL-SECURITY-USERID: " . $api_user, "X-PAYPAL-SECURITY-PASSWORD: "******"X-PAYPAL-SECURITY-SIGNATURE: " . $signature, "X-PAYPAL-APPLICATION-ID: " . $apiid, "X-PAYPAL-DEVICE-IPADDRESS: " . $_SERVER['REMOTE_ADDR'], "X-PAYPAL-REQUEST-DATA-FORMAT: NV", "X-PAYPAL-RESPONSE-DATA-FORMAT: XML"));
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    $content = curl_exec($ch);
    $err = curl_errno($ch);
    $errmsg = curl_error($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    $header['errno'] = $err;
    $header['errmsg'] = $errmsg;
    $header['content'] = $content;
    return $header;
}
$cont = get_web_page($link, $params, $api_user, $api_pass, $signature, $apiid);
$co = $cont['content'];
$arr = my_xml2array($co);
//echo '<pre>';
//print_r( $arr );
//echo '<pre>';
//exit;
$ap = $arr[0][1]['value'];
if (empty($ap)) {
    echo "ERROR<br/>";
    echo '<pre>';
    print_r($arr);
    echo '<pre>';
    exit;
}
update_post_meta($pid, 'adaptive_key', $ap);
Ejemplo n.º 24
0
<?php

$response = get_web_page('http://yandex.ru');
$html = new DOMDocument();
$html->loadHTML($response);
getValue($html, 'inline-stocks__item_id_1', 'USD:');
getValue($html, 'inline-stocks__item_id_23', 'EUR:');
/**
 * Возвращает страницу в виде текста
 * @param  string $url адрес страницы
 * @return string      код страницы
 */
function get_web_page($url)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true);
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    $content = curl_exec($ch);
    curl_close($ch);
    return $content;
}
/**
 * [getValue description]
 * @param  object $dom       объект DOMDocument()
 * @param  string $classname название класса на странице
 * @param  string $title     название валюты
 */
function getValue(DOMDocument $dom, $classname, $title)
{
    $finder = new DomXPath($dom);
    $div = $finder->query("//*[contains(@class, '{$classname}')]");
Ejemplo n.º 25
0
 function getimages($url)
 {
     $url = trim($url);
     if (strpos(strtoupper(trim($url)), "HTTP") === 0) {
         //do nothing
     } else {
         $url = "http://" . $url;
     }
     $html3 = file_get_contents($url);
     if (isset($ret)) {
         $ret = $this->processhtml($html3, $url, $ret);
     } else {
         $ret = $this->processhtml($html3, $url, array());
     }
     if (count($ret) < 3) {
         if (!function_exists('curl_init')) {
             die('CURL is not installed!');
         }
         $ch = curl_init();
         $thepage = get_web_page($url);
         $html1 = $thepage['content'];
         $ret = processhtml($html1, $url, $ret);
     }
     if (count($ret) < 3) {
         $timeout = 15;
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_ENCODING, "");
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         $html2 = curl_exec($ch);
         curl_close($ch);
         $ret = processhtml($html2, $url, $ret);
     }
     if (count($ret) < 3) {
         $html4 = url_get_contents($url);
         $ret = processhtml($html4, $url, $ret);
     }
     if (count($ret) < 3) {
         $html5 = urlload($url);
         $ret = processhtml($html5, $url, $ret);
     }
     //foreach ($ret as $key=>$value) {
     //	$img = explode("\n", $value);
     //	if (($img[1] == 99) && ($img[2] == 99)) {
     //
     //		$thumbnail = imagecreatefromstring(file_get_contents($img[3]));
     //		$width = imagesx($thumbnail);
     //		$height = imagesy($thumbnail);
     //		ImageDestroy($thumbnail);
     //		if (trim($width) != "") {
     //			$value = sprintf('%07d', $height + $width) . "\n" . sprintf('%06d', $height) . "\n" . sprintf('%06d', $width) . "\n" . $img[3]
     //		}
     //	}
     //}
     //rsort($ret);
     return $ret;
 }
Ejemplo n.º 26
0
    $errmsg = curl_error($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    $header['errno'] = $err;
    $header['errmsg'] = $errmsg;
    $header['content'] = $content;
    return $header;
}
?>

<?php 
$ar = array("yahoo.com");
$i = 0;
//Read a web page and check for errors:
foreach ($ar as $url) {
    $result = get_web_page($url);
    if ($result['errno'] != 0) {
        //  ... error: bad url, timeout, redirect loop ...
        if ($result['http_code'] != 200) {
            // ... error: no page, no permissions, no service ...
            $page = $result['content'];
        }
    }
    //echo $page;
    //print_r($result['content']);
    $html = str_get_html($result['content']);
    if (is_object($html)) {
        $file = fopen("C:/xampp/htdocs/homepage/tests/" . $url . ".html", "w");
        echo fwrite($file, $html);
        fclose($file);
        $t = $html->find("title", 0);
Ejemplo n.º 27
0
		curl_close ($ch);
	}    

test_paypal() ;*/
if (isset($session->userid) && isset($_POST['item_name_1']) && isset($_POST['amount_1']) && $_POST['amount_1'] != 0) {
    //$invoiceid = $database->getNextInvoice($session->userid, stripslashes($_POST['amount_1'],'START');
    $invoiceid = 1;
    $values = "cmd=_cart";
    $values .= "&upload=1";
    $values .= "&business=" . PAYPAL_ACCOUNT;
    $values .= "&invoice=" . $invoiceid;
    if (isset($_POST['item_name_1']) && isset($_POST['amount_1'])) {
        $values .= "&item_name_1=" . stripslashes($_POST['item_name_1']);
        $values .= "&amount_1=" . stripslashes($_POST['amount_1']);
    }
    get_web_page(PAYPALADDRESS, $values);
}
function get_web_page($url, $curl_data)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.sandbox.paypal.com/cgi-bin/webscr");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'cmd=_cart&upload=1&business=pranja_1242728885_biz@jaguarinfotech.com&item_name1=aggregate%20items&amount=10.00');
    $content = curl_exec($ch);
    //echo 'hi';
    curl_close($ch);
    //  $header['errno']   = $err;
    //  $header['errmsg']  = $errmsg;
    //  $header['content'] = $content;
Ejemplo n.º 28
0
    exit;
} else {
    if (isset($_POST['cancel'])) {
        $msg->addFeedback('IMPORT_CANCELLED');
        header('Location: ../content/index.php');
        echo '4';
        exit;
    }
}
$cid = intval($_POST['cid']);
//If user chooses to ignore validation.
if (isset($_POST['ignore_validation']) && $_POST['ignore_validation'] == 1) {
    $skip_ims_validation = true;
}
if (isset($_POST['url']) && $_POST['url'] != 'http://') {
    $content = get_web_page($_POST['url']);
    // save file to /content/
    $filename = substr(time(), -6) . '.zip';
    $full_filename = AT_CONTENT_DIR . $filename;
    //$fp = fopen($full_filename,'w+b');
    //chmod($full_filename, 0777);
    if (!($fp = fopen($full_filename, 'w+b'))) {
        echo "Cannot open file ({$filename})";
        echo '6';
        exit;
    }
    if (fwrite($fp, $content, strlen($content)) === FALSE) {
        echo "Cannot write to file ({$filename})";
        echo '7';
        exit;
    }
    if (!$check_pong) {
        return 700;
    }
    return $header['httpCode'];
}
function delProxy($id)
{
    global $config;
    cdim('db', 'query', 'DELETE FROM `proxy` WHERE `id` = ' . $id);
    //file_put_contents('bbb.bbb', 'checkurl.php->'.$id."\r\n\r\n", FILE_APPEND);
}
/*
тут чекали все
$proxy = cdim('db','query','SELECT * FROM `proxy`');
if (isset($proxy)) foreach($proxy as $k=>$v) {
	$pong = get_web_page($v->url);
	if ($pong != 200) {
		delProxy($v->id);
	}
}
*/
// чекаем первый в списке
$proxy = cdim('db', 'query', 'SELECT * FROM `proxy` LIMIT 1');
if (isset($proxy)) {
    foreach ($proxy as $k => $v) {
        $pong = get_web_page($v->url);
        if ($pong = 200) {
            delProxy($v->id);
        }
    }
}
Ejemplo n.º 30
-5
function scrap_overstock_all($url, $id)
{
    $curl_result = get_web_page($url);
    if ($curl_result['http_code'] == 200) {
        $document = phpQuery::newDocument($curl_result['content']);
        $result['offerprice'] = str_replace('$', '', pq_get_first_text('span[itemprop=price]'));
        $result['prime'] = $result['quantity'] && $result['offerprice'] ? 'Yes' : 'No';
        $result['scrapok'] = true;
    } else {
        $result['scrapok'] = false;
    }
    return $result;
}