可以说,我发现一个网站,有以下标记:Laravel - 是否可以从外部网站将数据保存到mySQL数据库?
<body>
<div id="paper">
<div id="contentwrapper">
<div id="rightcontent">
<h1>1967-002A</h1>
<p>
<strong>NSSDCA/COSPAR ID:</strong> 1967-002A</p>
<div class="twocol">
<div class="urone">
<h2>Description</h2>
<p>
This US Air Force photo surveillance satellite was launched from Vandenberg AFB aboard a Thor Agena D rocket. It was a KH-4A (Key Hole-4A) type satellite. The satellite had fair image quality.
</p>
</div>
<div class="urtwo">
<h2>Alternate Names</h2>
<ul>
<li>02642</li>
</ul>
<h2>Facts in Brief</h2>
<p>
<strong>Launch Date:</strong> 1967-01-14
<br/>
<strong>Launch Vehicle:</strong> Thor
<br/>
<strong>Launch Site:</strong> Vandenberg AFB, United States
<br/>
<strong>Mass:</strong> 1500.0 kg
<br/>
</p>
<h2>Funding Agency</h2>
<ul>
<li>Department of Defense-Department of the Air Force (United States)</li>
</ul>
<h2>Discipline</h2>
<ul>
<li>Surveillance and Other Military</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
这包含的信息,如说明,发布日期,运载火箭,发射场和群众,资助机构和纪律。 - 这些都可以是mySQL数据库中的列。
该网页的链接/spacecraftDisplay.do?id=1967-002A
。我已经有了一个数据库 - 1967-002A
- 航天器标识符。所以我猜测要从我的数据库中获取每个标识符并使用相同的标识符保存来自URL的数据。每个网页都是一样的
我已经知道如何使用Guzzle从具有JSON格式的外部API保存数据。我们正在处理外部网站的HTML,而不是JSON。
我首先想知道的是,如果它甚至可能从网页上保存这些数据,或者您可以做什么的限制?
我有类似的问题,我用硒来读取HTML并从中获取值。 –
你在找什么叫做“DOM解析器”。您可以使用它来解析来自结构化HTML的信息。 – David