当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::ConvertRelativeToAbsoluteURL方法代码示例

本文整理汇总了PHP中HTTP::ConvertRelativeToAbsoluteURL方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::ConvertRelativeToAbsoluteURL方法的具体用法?PHP HTTP::ConvertRelativeToAbsoluteURL怎么用?PHP HTTP::ConvertRelativeToAbsoluteURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP的用法示例。


在下文中一共展示了HTTP::ConvertRelativeToAbsoluteURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

            echo "\t" . HTTP::ConvertRelativeToAbsoluteURL($result["url"], $row->href) . "\n";
        }
    }
}
$result = $web->Process("https://www.barebonescms.com/");
if (!$result["success"]) {
    echo "[FAIL] An error occurred.  " . $result["error"] . "\n";
} else {
    if ($result["response"]["code"] != 200) {
        echo "[FAIL] An unexpected response code was returned.  " . $result["response"]["line"] . "\n";
    } else {
        echo "[PASS] The expected response was returned.\n";
        $html->load($result["body"]);
        $rows = $html->find('a[href]');
        foreach ($rows as $row) {
            echo "\t" . HTTP::ConvertRelativeToAbsoluteURL($result["url"], $row->href) . "\n";
        }
    }
}
// Test asynchronous access.
$urls = array("http://www.barebonescms.com/", "http://www.cubiclesoft.com/");
// Build the queue.
$helper = new MultiAsyncHelper();
$pages = array();
foreach ($urls as $url) {
    $pages[$url] = new WebBrowser();
    $pages[$url]->ProcessAsync($helper, $url, NULL, $url);
}
// Mix in another file handle type for fun.
$fp = fopen(__FILE__, "rb");
stream_set_blocking($fp, 0);
开发者ID:watsonweber,项目名称:ultimate-web-scraper,代码行数:31,代码来源:test_suite.php

示例2: ExtractForms

 public function ExtractForms($baseurl, $data)
 {
     $result = array();
     if ($this->html === false) {
         $this->html = new simple_html_dom();
     }
     $this->html->load($data);
     $html5rows = $this->html->find("input[form],textarea[form],select[form],button[form],datalist[id]");
     $rows = $this->html->find("form");
     foreach ($rows as $row) {
         $info = array();
         if (isset($row->id)) {
             $info["id"] = trim($row->id);
         }
         if (isset($row->name)) {
             $info["name"] = (string) $row->name;
         }
         $info["action"] = isset($row->action) ? HTTP::ConvertRelativeToAbsoluteURL($baseurl, (string) $row->action) : $baseurl;
         $info["method"] = isset($row->method) && strtolower(trim($row->method)) == "post" ? "post" : "get";
         if ($info["method"] == "post") {
             $info["enctype"] = isset($row->enctype) ? strtolower($row->enctype) : "application/x-www-form-urlencoded";
         }
         if (isset($row->{"accept-charset"})) {
             $info["accept-charset"] = (string) $row->{"accept-charset"};
         }
         $fields = array();
         $rows2 = $row->find("input,textarea,select,button");
         foreach ($rows2 as $row2) {
             if (!isset($row2->form)) {
                 $this->ExtractFieldFromDOM($fields, $row2);
             }
         }
         // Handle HTML5.
         if (isset($info["id"]) && $info["id"] != "") {
             foreach ($html5rows as $row2) {
                 if (strpos(" " . $info["id"] . " ", " " . $row2->form . " ") !== false) {
                     $this->ExtractFieldFromDOM($fields, $row2);
                 }
             }
         }
         $form = new WebBrowserForm();
         $form->info = $info;
         $form->fields = $fields;
         $result[] = $form;
     }
     return $result;
 }
开发者ID:harrylongworth,项目名称:tv-bb,代码行数:47,代码来源:web_browser.php


注:本文中的HTTP::ConvertRelativeToAbsoluteURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。