PHP/cURL code not letting me select the link I want

I have a PHP/cURL code that displays this webpage:

http://www.solomid.net/guide?champ=alistar&featured=1&submitted=0&sort=3

Here is the code:

<?php

            $ch = curl_init('http://www.solomid.net/guide?champ=alistar&featured=1&submitted=0&sort=3');

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
            $result = curl_exec ($ch);
            curl_close($ch);
            echo $result;

    ?>

The problem is, the guide tilted “Alistar - Can you milk those?” when clicked, gives me an error. But if i click absolutely anything else on the page, it works perfectly fine.

It’s because the link is “relative”, all the others that work are “absolute”

You see the part in bold:
<a href=“/guide/view/29174-alistar-build-guide-by-uskelm”>Alistar - Can you milk those?</a>
it starts with a slash, it means “from the beginning of the current URL”.
If you want it to work, it should be <a href=“[B]http://www.solomid.net/guide/view/29174-alistar-build-guide-by-uskelm[/B]”>Alistar - Can you milk those?</a>

So you can replace all the strings ‘href="/’ with ‘href="http://www.solomid.net/’ and it should work.

Hello, thanks for the reply. How can i replace the strings?

str_replace should work.

This will replace <a href="/ with <a href="http://www.solomid.net/ :

$result = str_replace('<a href="/', '<a href=http://www.solomid.net/', $result);

Tip : If you need to know how to do something with PHP, you can try Google. Something like: “How to replace a string with PHP” would get you the answer :wink: