This is what I learnt tonight at another place:
When you connect to the site, if it gives you a 301 header which is an indicator that the real address is something else. In this case:
when you see error at:
I can also add option to follow 30x redirects:
CURLOPT_FOLLOWLOCATION - follow HTTP 3xx redirects.
(The code is what I learn tonight and not about the 301 header issue as I already knew that from ages ago).
Ok. I can see an improvement with a suggested code. Check it out yourself. Although, all that header stuff echoed at the top of the screen looks unclean. Doesnât it ? Getting rid of the echo.
Error 301 is something you have no control over. Only the person who owns that website does. Itâs also not an error you should be worried about. Simply put, it means that the location is moved and where ever they redirected you to, thatâs where it was moved to. Itâs to tell web crawlers that the redirected place should be the new place the web crawlers should crawl. Thatâs it.
These errors donât really pertain to PHP at all. Itâs more of an HTTP related subject. Although PHP can set headers, I donât think this particular issue has anything to do with PHP except the PHP code you posted.
I never should have opened this thread! Silly me!
Have a guess what I did!
Using cURL, I fetched:
(note: No âwwwâ).
And faced that 301 error.
Opened Chrome naturally, to see if it shows the same error or not while I manually head-over to ebay. Now, instead of navigating manually over to:
I navigated to: http://www.ebay.com
(Note the âwwwâ).
I saw no error there and so got puzzled why cURL was showing the error! Therefore, opened this thread.
But now, i spotted my mistake!
This thread should be closed.
Thanks everyone.