本文整理汇总了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);
示例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;
}