Check website redirection programmatically

In my country, many sites are censored and blocked and instead redirected to a specific page. I don’t know how they do it. But is it possible to programmatically determine whether the site is blockedor not without downloading it all? The reason I want to do this is to use a web search API (possibly Google) and make a web service that only brings results that are not blocked.

If this helps, the contents of the page you load are as follows:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"><title>M3-5
</title></head><body><iframe src="http://10.10.34.34?type=Invalid Site&policy=MainPolicy " style="width: 100%; height: 100%" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0"></iframe></body></html>

I understand that the server running the service must have the IP address of my country.

It would be better if there was a way to do this in PHP or Python.

I appreciate any help or idea.

+5
source share
1 answer

This should be fully possible in both PHP and Python. Basically, you want to send an HTTP request to the site in question, and then analyze the response that you will return. Take a look at PHP cURL or Python Pycurl to figure out how to issue these HTTP requests and how to handle the responses.

, . , <body><iframe src="http://10.10.34.34?type=Invalid Site , , , . , , , , .

+3

All Articles