https://www.godaddy.com/domains/popups/chart.aspx
我想为流行域的通用 TLD 刮下更新价格。
我正在寻找源代码,但没有看到价格数字.... 这些变量在哪里找到?
https://www.godaddy.com/domains/popups/chart.aspx
我想为流行域的通用 TLD 刮下更新价格。
我正在寻找源代码,但没有看到价格数字.... 这些变量在哪里找到?
Prices are generated dynamically after the page's load... here's the link of prices of the default table
It returns a json file that could be parsed using json_decode()
To see what's dynamically changing while interacting with the page, In chrome, launch the developper tools
then Network
tab from the top and XHR
tab from the bottom...
In that tab you'll see all dynamic communications between the website and the server
Here's a working example:
// includes Simple HTML DOM Parser
require_once "php/lib/simplehtmldom_1_5/simple_html_dom.php";
$url = "https://www.godaddy.com/domains/controls/jsoncontent/generalpricing.aspx?tab=general&widthreduction=160&hidelinks=true&TargetDivId=tabgj_new®t=new&_=1380620289373";
// Download json file and converts it into a PHP variable
$jsonData = json_decode(file_get_contents($url));
// get html data from the json object
$htmlData = $jsonData->Html;
/*
* Parse the HTML DOM using Simple HTML DOM Parser
*/
//Create a DOM object
$html = new simple_html_dom();
// Load HTML from a string
$html->load($htmlData);
// Print results
foreach($html->find("table tr") as $index => $row) {
switch ($index) {
case '0': // Print table header
foreach($row->find("th") as $col) {
echo $col->plaintext;
echo " | ";
}
echo "<br/>---<br/>";
break;
default: // Print all rows
foreach($row->find("td") as $col) {
echo $col->plaintext;
echo " | ";
}
echo "<br/>---<br/>";
break;
}
}
OUTPUT:
-------
Per year pricing | 1 year | 2 years | 3 years | 5 years | 10 years |
---
.COM | $12.99* $14.99* | $13.99* $14.99* | $14.33* $14.99* | $14.59* $14.99* | $14.79* $14.99* |
---
.CO | $12.99 $29.99 | $21.49 $29.99 | $24.33 $29.99 | $26.59 $29.99 | -- |
---
.INFO | $2.99* $14.99* | $8.99* $14.99* | $10.99* $14.99* | $12.59* $14.99* | $13.79* $14.99* |
---
.ORG | $9.99* $17.99* | $13.99* $17.99* | $15.33* $17.99* | $16.39* $17.99* | $17.19* $17.99* |
---
.NET | $9.99* $16.99* | $13.49* $16.99* | $14.66* $16.99* | $15.59* $16.99* | $16.29* $16.99* |
---
.ME | $9.99 $19.99 | $14.99 $19.99 | $16.66 $19.99 | $17.99 $19.99 | $18.99 $19.99 |
---
.MOBI | $9.99* $17.99* | $13.99* $17.99* | $15.33* $17.99* | $16.39* $17.99* | $17.19* $17.99* |
---
.US | $3.99 $19.99 | $11.99 $19.99 | $14.66 $19.99 | $16.79 $19.99 | $18.39 $19.99 |
---
.BIZ | $6.99* $16.99* | $11.99* $16.99* | $13.66* $16.99* | $14.99* $16.99* | $15.99* $16.99* |
---
.CA | $12.99 | $12.99 | $12.99 | $12.99 | $12.99 |
---
.CC | $19.99 | $19.99 | $19.99 | $19.99 | $19.99 |
---
.LA | $39.99 | $39.99 | $39.99 | $39.99 | $39.99 |
---
.TV | $39.99 | $39.99 | $39.99 | $39.99 | $39.99 |
---
.WS | $15.99 | $15.99 | $15.99 | $15.99 | $15.99 |
---
.ASIA | $19.99* | $19.99* | $19.99* | $19.99* | $19.99* |
---
.XXX | $99.99* | $99.99* | $99.99* | $99.99* | $99.99* |
---