I’ll put words in your mouth:
Nice Try UI.
Here’s a code sample you asked for. Let me know what you think.
$url = "http://google.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
The above regex can precede the tracker link onto all links (absolute and relative links) found on the cURL fetched page.
So, an absolute link that originally looks like this:
is now shown as this by cURL:
So far, so good.
But an absolute link that looks like this:
is getting shown by cURL like this:
So the regex is preceding the tracker url on all links present on the cURL fetched page alright but it is not replacing the “localhost” part.
Now, I need to add another line of code to replace the “localhost” on relative links with the current page’s domain name. That is 2 sets of code. Would be better, if one regex did both tasks. And that is, precede the tracker url onto relative links by replacing the “localhost”. Is this possible ?
Anyway, an idea has popped into my mind.
How-about you guys (seniors) with fair experience (and when you have the time or when you’re feeling bored and need to do something interesting to pass time rather than go to the bar, eg. like weekends), build code puzzles (in a “puzzle solving thread”) from time to time and see who can solve it.
This is where you write the codes for a specific task and then leave a few gaps for newbies to fill-in. As a sort of a test. Would be a great learning exercise. I reckon even intermediate and pro people would join in.
I might aswell contribute a little and build some of my own for my juniors to play with.
You know. No-one really knows it all. Even the intermediate and adv guys might find-out that they’ve learnt or understood something wrong and learn a little. Just one way for their errors to be caught. Isn’t there some sort of a saying that, the teacher becomes more expert when he starts teaching as he learns from his own teaching or from the feedback he gets from his students. Or, whatever.
I think it is a good idea. As I learn along, I can build puzzles after I finish each chapter. New newbies can do the same. Oldbies can come and check now and then how the newbies are fairing. I’m gonna have this topic at the back of my head (subconscious) and try building on the idea. The puzzle ghost has entered my head now and it ain’t going anytime soon.
Anyway, back to the topic.