PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Aug 24, 2017 12:02 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed May 24, 2017 5:45 pm 
Offline
Forum Contributor

Joined: Wed Jan 18, 2017 4:43 pm
Posts: 102
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group