开发者

PHP Scraping - file_get_contents redirect limit?

开发者 https://www.devze.com 2023-02-14 07:17 出处:网络
I\'m trying to scrape the courses from ASU\'s schedule of classes page. I\'m doing something like this:

I'm trying to scrape the courses from ASU's schedule of classes page.

I'm doing something like this:

$url = "https://webapp4.asu.edu/catalog/classlist?s=P开发者_JAVA技巧SY&t=2117&e=all&hon=F";
$html = file_get_contents($url);
echo $html;

Now, when I go to a classes page loads listing all of the pysch classes. But, when I try to echo the above URL (which isn't broken) I get an error about "redirect limit reached, aborting...".

How can I fix this?


I get an error about "redirect limit reached, aborting...".

This is something you probably can't do anything about. You are getting this error because the page you requested keeps redirecting in a way that it cannot end (loop redirection).

That's a problem on the page you are requesting.

Chances that you're getting a redirect is because of certain headers / cookies that the page require and you cannot supply through the use of file_get_contents(). Try using the cURL Library instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消