本文整理汇总了PHP中get_web_page函数的典型用法代码示例。如果您正苦于以下问题:PHP get_web_page函数的具体用法?PHP get_web_page怎么用?PHP get_web_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_web_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delProxy
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=' . DELPASS;
$qq = get_web_page($url);
//file_put_contents('bbb.bbb', 'checkurl4u.php->DEL PROXY'."\r\n\r\n", FILE_APPEND);
}
示例2: get_http_page
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'];
}
示例3: GetButch
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;
}
示例4: scrap_overstock_all
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;
}
示例5: tc2info
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;
}
示例6: NetworkSettings_Ajax
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);
}
示例7: getContent
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']);
}
}
示例8: makeSure
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, '通过验证。');
}
}
示例9: getimages
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;
}
示例10: curl_error
$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);
示例11: get_web_page
<?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}')]");
示例12: array_map
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}'}";
示例13: test_paypal
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;
示例14: foreach
$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';
示例15: get_web_page
<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;