/** * 获取用户token * 向该地址获取用户的token,用于换取用户openid:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea75c703e3c51ec3&redirect_uri=http%3A%2F%2F119.29.12.215%2FMobile%2FPublic%2Fbangding&response_type=code&scope=snsapi_base#wechat_redirect */ private function getToken($jumpUrl) { $url = "https://open.weixin.qq.com/connect/oauth2/authorize"; //$jumpUrl :::: "http://119.29.12.215/Mobile/Public/loginBangding"; //回调地址 js urlencode $jumpUrl = $jumpUrl; $getData['appid'] = C('AppID'); $getData['redirect_uri'] = iconv("utf-8", "gb2312//IGNORE", $jumpUrl); $getData['response_type'] = 'code'; $getData['scope'] = 'snsapi_base'; $getData['raw_string'] = '#wechat_redirect'; $queryString = buildUrl($getData); $url = $url . "?" . $queryString; redirect($url); }
function buildUrl($length, $prefix = '') { for ($j = 97; $j < 123; $j++) { if ($length > 1) { buildUrl($length - 1, $prefix . chr($j)); } else { $last = $prefix . chr($j) . ''; for ($i = 1; $i < 26; $i = ++$i) { $page = '&page=' . $i; //$fullUrl = 'https://www.nremt.org/nremt/about/displayEMTDetail.asp?state=OH&last=' . '' . $last . '' . $page . chr(13) . chr(10); $fullUrl = '"https://www.nremt.org/nremt/about/displayEMTDetail.asp?state=OH&last=' . '' . $last . '' . $page . '",'; echo $fullUrl; } } } }
function buildUrl($length, $prefix = '') { global $sources; for ($j = 97; $j < 123; $j++) { if ($length > 1) { buildUrl($length - 1, $prefix . chr($j)); } else { $last = $prefix . chr($j) . ''; for ($i = 1; $i < 2; $i = ++$i) { $page = '&page=' . $i; $fullUrl = 'https://www.nremt.org/nremt/about/displayEMTDetail.asp?state=NJ&last=' . '' . $last . '' . $page . chr(13) . chr(10); echo $fullUrl; array_push($sources, $fullUrl); //save url to array } } } }
function buildUrl($length, $prefix = '') { global $sources; for ($j = 97; $j < 123; $j++) { if ($length > 1) { buildUrl($length - 1, $prefix . chr($j)); } else { $last = $prefix . chr($j) . ''; for ($i = 1; $i < 5; $i = ++$i) { $page = '&showpage=' . $i; $fullUrl = 'https://www.njoemscert.com/extCertView/index.cfm?fuseaction=SearchUsers&Search=Search&vchLastName=' . '' . $last . '' . $page . chr(13) . chr(10); echo $fullUrl; array_push($sources, $fullUrl); //save url to array } } } }
public function testBuildUrl() { $url = "endpoint?key=value&another=weird==thing"; $this->assertEquals("endpoint?key=value&another=weird%3D%3Dthing&third=val", buildUrl($url, ['third' => 'val'])); }
echo '<span class="label label-info pull-right" style="font-size : 1em;">' . config::byKey('market::username'); try { market::test(); echo ' <i class="fa fa-check"></i>'; } catch (Exception $e) { echo ' <i class="fa fa-times"></i>'; } echo '</span>'; } ?> </div> </form> </div> <?php if ($name != null && strpos($name, '$') !== false) { echo '<a class="btn btn-default" id="bt_returnMarketList" style="margin-top : 50px;" data-href=' . buildUrl('name', '') . '><i class="fa fa-arrow-circle-left"></i> {{Retour}}</a>'; } ?> <div style="padding : 5px;"> <?php $categorie = ''; $first = true; $nCategory = 0; foreach ($markets as $market) { $update = update::byLogicalId($market->getLogicalId()); $category = $market->getCategorie(); if ($category == '') { $category = 'Aucune'; }
<div id="endtimebox"> <a alt="End 1 day earlier" href="<?php echo buildUrl('endtime') . '&endtime=' . ($endtime - 60 * 60 * 24); ?> ">«</a> <a alt="End 1 hour earlier" href="<?php echo buildUrl('endtime') . '&endtime=' . ($endtime - 60 * 60); ?> ">‹</a> endtime <a alt="End 1 hour later" href="<?php echo buildUrl('endtime') . '&endtime=' . ($endtime + 60 * 60); ?> ">›</a> <a alt="End 1 day later" href="<?php echo buildUrl('endtime') . '&endtime=' . ($endtime + 60 * 60 * 24); ?> ">»</a> </div> </div> </div> <?php } ?> <h1>Add Sensor</h1> <form class="tableform" action="index.php" method="POST"> <div> <lable for="uid">UID:</lable> <input id="uid" name="uid" type="text" required="required"/> </div>
} if ($cmd != "downl") { if ($isMainMenu != true) { ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" style="class="silver border"> <center><strong> <?php echo buildUrl("<font color=\"navy\">[ Main Menu ] </font>", "cmd=&dir="); ?> <?php echo buildUrl("<font color=\"navy\">[ R00T ] </font>", "cmd=dir&dir=."); ?> </strong></center> </td> </tr> </table> <br> <?php } ?> <table width=100% border="0" cellpadding="0" cellspacing="0"> <tr> <td width="100%" class="silver border"> <center> <?php include $a . $b . $c;
<td width="100%" style="class="silver border"> <center><strong> <?php echo buildUrl("<font color=\"navy\">[ Main Menu ] </font>", "cmd=&dir="); ?> <?php echo buildUrl("<font color=\"navy\">[ PHPKonsole ] </font>", "cmd=con"); ?> <?php echo buildUrl("<font color=\"navy\">[ Haxplorer ] </font>", "cmd=dir&dir=."); ?> </strong></center> </td> </tr> </table> <br> <?php }
} } $pageParams = array('elementsBefore' => $elements['before'], 'elementsAfter' => $elements['after'], 'pagesBefore' => ceil($elements['before'] / $elements['display']), 'pagesAfter' => ceil($elements['after'] / $elements['display'])); if (!is_null($beforeStart)) { $tpl = $DLObj->getCFGDef('TplPrevP', '@CODE: <a href="[+url+]">Назад</a>'); $beforePage = $DLObj->parseChunk($tpl, array_merge($pageParams, array('url' => buildUrl($DLObj->getUrl(), $beforeStart), 'offset' => $beforeStart, 'elements' => $elements['before'], 'pages' => ceil($elements['before'] / $elements['display'])))); } else { if ($DLObj->getCFGDef("PrevNextAlwaysShow", 0)) { $tpl = $DLObj->getCFGDef('TplPrevI', '@CODE: Назад'); $beforePage = $DLObj->parseChunk($tpl, array_merge($pageParams, array('elements' => $elements['before'], 'pages' => ceil($elements['before'] / $elements['display'])))); } } $modx->setPlaceholder('pages.before', $beforePage); if (!is_null($afterStart)) { $tpl = $DLObj->getCFGDef('TplNextP', '@CODE: <a href="[+url+]">Далее</a>'); $afterPage = $DLObj->parseChunk($tpl, array_merge($pageParams, array('url' => buildUrl($DLObj->getUrl(), $afterStart), 'offset' => $afterStart, 'elements' => $elements['after'], 'pages' => ceil($elements['before'] / $elements['display'])))); } else { if ($DLObj->getCFGDef("PrevNextAlwaysShow", 0)) { $tpl = $DLObj->getCFGDef('TplNextI', '@CODE: Далее'); $afterPage = $DLObj->parseChunk($tpl, array_merge($pageParams, array('elements' => $elements['after'], 'pages' => ceil($elements['before'] / $elements['display'])))); } } $modx->setPlaceholder('pages.after', $afterPage); $debug = $DLObj->getCFGDef('debug', 0); if ($debug) { if ($debug > 0) { $out = $DLObj->debug->showLog() . $out; } else { $out .= $DLObj->debug->showLog(); } }
global $sources; for ($i = 10605; $i <= 300000; $i++) { //for($i = 99000; $i <= 100000; $i++) { $fullUrl = 'https://myoracle.in.gov/reports/rwservlet?acadisepnhtml&report=acadis_person_detail.rdf&p_personid=' . '' . $i . '' . chr(13) . chr(10); echo $fullUrl; array_push($sources, $fullUrl); //save url to array } } /*https://myoracle.in.gov/reports/rwservlet?acadisepnhtml&report=acadis_person_detail.rdf&p_personid=*/ error_reporting(0); require 'scraperwiki/simple_html_dom.php'; //stores list of urls $sources = array(); //build urls and save to $sources buildUrl(); //iterate through sources foreach ($sources as $page) { set_time_limit(0); $html = scraperWiki::scrape($page); $dom = new simple_html_dom(); $dom->load($html); $store_arr = array(); $counter = 0; foreach ($dom->find('<font face=') as $tds) { //echo $tds->plaintext . chr(13) . chr(10); $result = $tds->plaintext; $store_arr[$counter++] = $result; //echo 'Result: ' . $result . chr(13) . chr(10); } //- end foreach
</form> <hr> <table border=1 width=50%> <tr> <th><a href="index.php?orderby=id<?php echo buildUrl(); ?> ">id</a></th> <th><a href="index.php?orderby=name<?php echo buildUrl(); ?> ">Name</a></th> <th><a href="index.php?orderby=email<?php echo buildUrl(); ?> ">Email</a></th> <th><a href="index.php?orderby=phone<?php echo buildUrl(); ?> ">Phone</a></th> <th><a href="index.php?orderby=date<?php echo buildUrl(); ?> ">Date</a></th> </tr> <?php showTable(); ?> </table> </body> </html>
/** * 发送http请求 * @param $data 需要发送的数据。array * @param $url 请求的地址 * @param $ispost 是否用post,默认post,false则使用get方式 * @return 请求结果 * @author wangxianlei */ function http_request($data, $url, $ispost = true) { if (!$ispost && !empty($data)) { $queryString = buildUrl($data); $url = $url . "?" . $queryString; } //echo $url; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //兼容https curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //返回不输出 //设置是通过post还是get方法 CURLOPT_HTTPGET if ($ispost) { curl_setopt($ch, CURLOPT_POST, 1); //传递的变量 // curl_setopt($ch,CURLOPT_HTTPHEADERS,array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } $data = curl_exec($ch); curl_close($ch); return $data; }
public function getActionUrl(array $params = NULL) { return buildUrl(fruitframe_get_permalink($this->_action), $params); }
$cache_host = $config['memcache_host']; $cache_port = $config['memcache_port']; $memcache = new Memcache(); $memcache->connect($cache_host, $cache_port) or die('Couldn\'t connect to memcache server. Is it running?'); // Set the API sport, endpoint, id, format, and any parameters $host = 'erikberg.com'; $sport = ''; $endpoint = 'events'; $id = ''; $format = 'json'; $parameters = ['sport' => 'nba', 'date' => date('Ymd')]; if (isset($_GET['d'])) { $parameters['date'] = $_GET['d']; } // Pass endpoint, format, and parameters to build request url $url = buildUrl($host, $sport, $endpoint, $id, $format, $parameters); $response = $memcache->get($url); if (!$response) { $response = httpGet($user_agent, $auth_header, $url); if ($response != null) { save_cache($memcache, $url, $response); } } $events = json_decode($response); // Create DateTime object using the ISO 8601 formatted events_date $date = DateTime::createFromFormat(DateTime::W3C, $events->events_date); ?> <!DOCTYPE html> <html> <head>
/** * 准备微博文字 */ function getWeiboText($row, $option, &$weibocontent) { unset($weibocontent['text']); unset($weibocontent['imgfile']); // 取得网站的root URI $u =& JFactory::getURI(); $root = $u->root(); // 根据微博文字的种类 if ($option['weibotype'] == 'fulltext') { // 1) 全文发表 $weibotext = $row->introtext . '<br>' . $row->fulltext; // 因为微博限制字数为140字,删去多出部分 $weibotext = mb_substr($weibotext, 0, WEIBO_LIMIT, 'utf-8'); } else { if ($option['weibotype'] == 'introtext') { // 2) 发表引文 $weibotext = $row->introtext; // 因为微博限制字数为140字,删去多出部分 $weibotext = mb_substr($weibotext, 0, WEIBO_LIMIT, 'utf-8'); } else { if ($option['weibotype'] == 'title') { // 3)发表标题 $weibotext = $row->title; // 因为微博限制字数为140字,删去多出部分 $weibotext = mb_substr($weibotext, 0, WEIBO_LIMIT, 'utf-8'); } else { // 4) 自定义发表文字 //$link = JRoute::_(getArticleRoute($row->id, $row->catid, $row->sectionid), false); 旧版本用这个方法 // 这里joomla1.6以上与joomla1.5有差别, if (version_compare(JVERSION, '1.6.0', 'ge')) { // 这部分是joomla1.6以上的程序, //$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->id, $row->catid)); //TODO: 目前仍然可能不能正确取得URL $link = ContentHelperRoute::getArticleRoute($row->id, $row->catid); //$link = buildUrl(ContentHelperRoute::getArticleRoute($row->id, $row->catid)); } else { // 这部分是joomla1.5 的程序 $link = buildUrl(ContentHelperRoute::getArticleRoute($row->id, $row->catid, $row->sectionid)); } // 取得发表者的名字 $user = JFactory::getUser(); $username = $user->name; $weibotext = str_replace('%T', $row->title, $option['customstring']); // %T 替换成文章的标题 $weibotext = str_replace('%F', $row->introtext . '<br>' . $row->fulltext, $weibotext); // %F 替换成文章的全文 $weibotext = str_replace('%I', $row->introtext, $weibotext); // %I 替换为引言 $weibotext = str_replace('%U', $username, $weibotext); // %U 替换成发表此文章的用户名 // 因为微博限制字数为140字,删去多出部分 $weibotext = mb_substr($weibotext, 0, WEIBO_LIMIT, 'utf-8'); //网址的替换在截取140文字以后做 $weibotext = str_replace('%H', $root, $weibotext); // %H 替换为网站网址 $weibotext = str_replace('%L', $root . $link, $weibotext); // %L (BETA)替换成此文章的URL } } } // 检查有无图片 $imgfile = false; if ($option['picsend']) { if (preg_match('/<img[^>]*src="([^"]+)"/is', $row->introtext . $row->fulltext, $matchs)) { if (strpos($matchs[1], 'images/') === 0) { $picurl = $root . $matchs[1]; } else { $picurl = $matchs[1]; } //如果有图片,取得图片数据 $imgfile = file_get_contents($picurl); } } // 清理文字 $weibotext = cleanText($weibotext); // 如果仅有图片,而无文字,则填充文字“无” if ($imgfile && !$weibotext) { $weibotext = '无'; } // 保存返回 $weibocontent['text'] = $weibotext; $weibocontent['imgfile'] = $imgfile; $weibocontent['imgurl'] = $picurl; }