PHP Developers Network
http://forums.devnetwork.net/

ERROR: HTTP/1.1 301 Moved Permanently Location
http://forums.devnetwork.net/viewtopic.php?f=1&t=143666
Page 1 of 1

Author:  UniqueIdeaMan [ Wed May 24, 2017 5:45 pm ]
Post subject:  ERROR: HTTP/1.1 301 Moved Permanently Location

Hard Men, :D

Check this weird thing out!
Fire-up your Wamp/Xampp and try this code:

Code:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://ebay.com");
curl_setopt($ch, CURLOPT_HEADER, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
$result = preg_replace("#(<\s*a\s+[^>]*href\s*=\s*[\"'])(?!http)([^\"'>]+)([\"'>]+)#",'$1http://mydomain.com/$2$3', $result);
echo $result
?>


Now, instead of ebay.com loading you will see an error mssg like so:

HTTP/1.1 301 Moved Permanently Location: http://www.ebay.com/

What does that mean ? On my Chrome, I don't see ebay.com showing any likewise mssg. Nor, am I getting redirected to any other page.

I found the code here:
https://stackoverflow.com/questions/105 ... urled-html

It is supposed to replace all relative links to absolute links.

Enjoy!

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/