[英]GuzzleHttp response parsing with Laravel
I am using GuzzleHttp with Laravel to get a response. 我在Laravel中使用GuzzleHttp来获得响应。 The problem I have is in the response after I use the
我遇到的问题是我使用
$client = new Client('http://idxbroker.com/');
$response = $client->get('idx/featured')->send();
$dom = $response->getBody();
It casts to a string, and I cannot figure a way to get the body element without the head.... 它强制转换为字符串,我无法找到一种方法来获取没有头部的身体元素。
ie I just need the response BODY tag, and its contents to remain in HTML format. 即我只需要响应BODY标签,其内容保持为HTML格式。
I have tried using DomCrawler, and several ways with Guzzle, but I am evidently lacking the understanding of how to extract the Body element in tact 我已经尝试过使用DomCrawler和Guzzle的几种方法,但是我显然缺乏对如何提取机体元素的理解。
any help would be appreciated, and let me know if there is any clarification I can provide 任何帮助将不胜感激,让我知道如果我可以提供任何澄清
IDX Broker TOS actually doesn't allow your to scrape the pages. IDX Broker TOS实际上不允许您抓取页面。 So I wouldn't do that.
所以我不会那样做。 You can get the featured listings from the API.
您可以从API获取特色列表。 Here is the docs: http://middleware.idxbroker.com/docs/api/1.1/index.php
这是文档: http : //middleware.idxbroker.com/docs/api/1.1/index.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.