×

Loading...
Ad by
Ad by

紧急求助:UNIX下C编程考试,大家来出主意,急!急!急!急!

要求UNIX下用C编程实现
1. get a URL as an argument in a command line
2. print the Google popularity rank for that website (number of links pointing to this website according to Google)
3. print websites IP address(es)
4. print MX records for that domain if any
5. print website and network owner information

对我来说:

1.没问题
2.不理解.popularity rank指在程序中嵌入google并搜索出指定URL的结果吗?如何嵌入GOOGLE到程序中去?或者说如何POST?
3.如果通过第2步得到了多个结果,通过在程序中嵌入system执行ping,再解析PING的输出得到IP地址.好象这么做太麻烦.
4.我写过一个程序库,虽然麻烦,可以得到MX记录.但我一直怀疑有函数可以直接获取MX记录,而自己没找到捷径.
5.不太明白.只是打印出来所有结果?


请大家看看如何实现上述要求,还有我理解和解决方法的对错.

急!急!急!急!急!急!
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / 紧急求助:UNIX下C编程考试,大家来出主意,急!急!急!急!
    要求UNIX下用C编程实现
    1. get a URL as an argument in a command line
    2. print the Google popularity rank for that website (number of links pointing to this website according to Google)
    3. print websites IP address(es)
    4. print MX records for that domain if any
    5. print website and network owner information

    对我来说:

    1.没问题
    2.不理解.popularity rank指在程序中嵌入google并搜索出指定URL的结果吗?如何嵌入GOOGLE到程序中去?或者说如何POST?
    3.如果通过第2步得到了多个结果,通过在程序中嵌入system执行ping,再解析PING的输出得到IP地址.好象这么做太麻烦.
    4.我写过一个程序库,虽然麻烦,可以得到MX记录.但我一直怀疑有函数可以直接获取MX记录,而自己没找到捷径.
    5.不太明白.只是打印出来所有结果?


    请大家看看如何实现上述要求,还有我理解和解决方法的对错.

    急!急!急!急!急!急!
    • 急鸡急!
    • answers
      1. get a URL as an argument in a command line
      2. print the Google popularity rank for that website (number of links pointing to this website according to Google)
      3. print websites IP address(es)
      4. print MX records for that domain if any
      5. print website and network owner information


      1.没问题
      OK
      2.不理解.popularity rank指在程序中嵌入google并搜索出指定URL的结果吗?如何嵌入GOOGLE到程序中去?或者说如何POST?
      You may run system a "CURL" to get the result, "wget" can also do it
      If you want to run native C and don't want to system external program,
      you can use CURL.lib for C

      3.如果通过第2步得到了多个结果,通过在程序中嵌入system执行ping,再解析PING的输出得到IP地址.好象这么做太麻烦.
      There is a function called gethostbyname()

      4.我写过一个程序库,虽然麻烦,可以得到MX记录.但我一直怀疑有函数可以直接获取MX记录,而自己没找到捷径.
      easy to run system nslookup -q=mx "URL" and parse the output

      5.不太明白.只是打印出来所有结果?
      That is for using whois, the same as above, print out whois result
      • 非常感谢! 请收PM,有我的EMAIL. 测试中...
      • 文中 popularity rank如何理解?是否只是GOOGLE搜索出的所有URL?
        比如:
        http://www.rolia.net/forum/forum_listSingleThread.php?pno=2304520
        为GOOGLE搜索的一个结果
        那末后面3~4步骤是否应该对www.rolia.net来操作?
      • curl包在solaris10 x86装上后执行老报错,郁闷.换了两个版本了.curl为什么就没有for solaris10 x86的版本呢?没法测试,郁闷.
        每次执行curl报错:
        ld.so.1: curl: fatal: libssl.so.0.9.7: open failed: No such file or directory
        Killed
        • www.sunfreeware.com, you can recompile it on x86. or download pkgs. Maybe you also need libgcc and openssl or it.
          • 装了openssl后curl可以用了,但是不能返回所要的google搜索信息,返回页面提示没有许可使用此用法。有人称google屏蔽了curl访问功能。
            仔细研究第2条发现:
            一个网站的popularity rank 可理解为“热点指数”,指由google统计出的指向该网站的连接数。
            因此,即使curl可以返回所要的google搜索信息也不能得到此参数。
            我正在查找如何解决。
          • 我理解popularity rank就是page rank,不知对否?如果是pagerank,变通获取比较容易。如何在程序里直接获取或计算出来?
      • 用C编程就干这个? 怎么看着是SHELL 程序就能干的?
      • whois server缺省使用的是whois.enom.com,不能得到详细的website and network owner information,国内有的公司的whois server就可以,但又只是对国内的website.有无其他方法获取website and network owner information呢?谢!
        其他已解决,popularis rank就当作pagerank处理了。
    • are you sure it is for C? i think, except 1. all other's is about protocol and network utilities usage.