Alex Alex - 1 year ago 78
PHP Question

Getting %3F on URLs

I'm using simplehtmldom and I'm trying to get all links from a website. This is my script:


// get DOM from URL or file
$html = file_get_html('');

// find all a tags
foreach($html->find('a') as $e)
echo $e->href . "\n";

What I'm getting is the full list of urls but some of them end with a %3F where there sould be a string. Something like:

Instead of:

I've done some research and it seems the fix needs to be done on the Apache server bu tI don't have access to it, is there anything I could do to fix it?

Answer Source

Just decode incoming url like this :

echo urldecode($e->href)."\n";

It will give the decoded url for string.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download