0

I will try to describe my issue as detailed as I can.

There is one live site at the moment, lets say http://example.com

I have one test site on a live server ,and I have modify my PC's hosts file as follows:

xx.xx.xx.xx example.com
xx.xx.xx.xx www.example.com

When I visit the example.com URL, I see my test website . However I have read some tutorials on how to check with curl if a URL returns 404 error etc.

I am trying to check some URLS with curl in PHP , in order to see which URLS return 404 error.

I have tried a lot different code samples, however they do not seem to work . Is there any way to make the curl to watch the test site, instead of the live one? I am trying to add header as curlopt , however it does not seem to see this URL.

Any ideas?

Archimidis M
  • 151
  • 1
  • 2
  • 9
  • Can you, in your question, make a clearer distinction between when you're talking about your live site and your test site? They seem the same to me, and sometimes I just don't know which one you're talking about. I also cannot get the jist of your question. – KIKO Software Jun 06 '16 at 22:40
  • Have you looked here? http://stackoverflow.com/questions/408405/easy-way-to-test-a-url-for-404-in-php – KIKO Software Jun 06 '16 at 23:00
  • Well, the live site is a site that everyone sees, and the test site is a website I am only capable of seeing because I have edited my PC's hosts file. The url of the test site is the same URL as the live site. I will have a look at your suggestion above. Thanks a lot. – Archimidis M Jun 07 '16 at 16:48
  • Well this does not work. I think something is missing. Although I am seeing the test site , the curl fetches the URLS of the "real" site,even I have added hosts file. – Archimidis M Jun 07 '16 at 18:18

0 Answers0