首页 > php教程 > php手册 > 正文

大学英语四六级成绩查询系统核心代码

php中文网
发布: 2016-06-21 09:05:58
原创
2842人浏览过

查询系统

  • 前几天做了个大学英语四六级成绩查询系统,一个 phprpc 版本,一个 wap 版本。它们的核心代码都是相同的。下面就是从 etang.cet 获取大学英语四六级成绩的核心代码:

    蓝心千询
    蓝心千询

    蓝心千询是vivo推出的一个多功能AI智能助手

    蓝心千询 34
    查看详情 蓝心千询
    下载: cetquery.php
    1. function query($examid, $examtype) {
    2.     $examid = trim($examid);
    3.     $examtype = trim($examtype);
    4.     if (!is_numeric($examid)) {
    5.         return '准考证号码必须是数字';
    6.     }
    7.     if (strlen($examid) != 15) {
    8.         return '准考证号码不正确';
    9.     }
    10.     if ($examtype == '1') {
    11.         if ((substr($examid, 6, 4) != '0521') &&
    12.             (substr($examid, 6, 4) != '1052')) {
    13.             return '准考证号码与考试类型不符';
    14.         }
    15.     }
    16.     if ($examtype == '2') {
    17.         if ((substr($examid, 6, 4) != '0512') &&
    18.             (substr($examid, 6, 4) != '0522') &&
    19.             (substr($examid, 6, 4) != '2052')) {
    20.             return '准考证号码与考试类型不符';
    21.         }
    22.     }
    23.     $examid1 = substr($examid, 0, 6) . $examtype . '052' . substr($examid, 10, 5);
    24.     $request = "examtype=$examtype&examid=$examid&image.x=23&image.y=32";
    25.     $content_len = strlen($request);
    26.     $handle = @fsockopen('cet.etang.com', 80, $errno, $errstr, 10);
    27.     $buf = '';
    28.     $id = base_convert(mt_rand().mt_rand(), 10, 36);
    29.     if ($handle) {
    30.         $http_request =
    31.             "POST /dog/cet HTTP/1.0\r\n" .
    32.             "Accept: */*\r\n" .
    33.             "Referer: http://cet.etang.com/cet_girldemand_$id.htm\r\n" .
    34.             "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Alexa Toolbar)\r\n" .
    35.             "Host: cet.etang.com\r\n" .
    36.             "Content-Type: application/x-www-form-urlencoded\r\n" .
    37.             "Content-Length: $content_len\r\n" .
    38.             "Cache-Control: no-cache\r\n" .
    39.             "Cookie: zi=A; examid1=$examid; examtype1=$examtype; sex=girl; examid=$examid1; examtype=$examtype\r\n" .
    40.             "\r\n" .
    41.             $request;
    42.         fputs($handle, $http_request, strlen($http_request));
    43.         while (!feof($handle)) {
    44.             $buf .= fgets($handle, 128);
    45.         }
    46.         fclose($handle);
    47.     }
    48.     else {
    49.         return "查询服务器暂时无法连接";
    50.     }
    51.     $buf = explode("\r\n", $buf);
    52.     $buf = $buf[11];
    53.     $score = "";
    54.     if (substr($buf, 0, 18) == 'Set-Cookie: score=') {
    55.         $score = substr($buf, 18, strpos($buf, ';') - 18);
    56.     }
    57.     if (($score != '') and ($score != 'error')) {
    58.         $score = explode(',', $score);
    59.     }
    60.     else {
    61.         return '你所查询的准考证号码不存在';
    62.     }
    63.     return $score;
    64. }


  • 最佳 Windows 性能的顶级免费优化软件
    最佳 Windows 性能的顶级免费优化软件

    每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

    下载
    来源:php中文网
    本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
    最新问题
    开源免费商场系统广告
    热门教程
    更多>
    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
    php中文网:公益在线php培训,帮助PHP学习者快速成长!
    关注服务号 技术交流群
    PHP中文网订阅号
    每天精选资源文章推送
    PHP中文网APP
    随时随地碎片化学习

    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号