Case-Sensitive Posted January 17, 2007 Share Posted January 17, 2007 HiIm trying to turn a href attribute from a link <a> element into a url.The problem Im having is that the link <a href="index.html">home</a>, just stores the filename, so when I try and use curl to get the contents from the page it gives a "unresolved host error". Which is because of the value in the fref is not a well formed url string.Is there a way of getting the servers path e.g http://localhost/site so i can prefix it onto the href attribute before passing it to the curl function.Ive tried the following, but it does not give a url, it does give working directories and stuffprint("<pre>");print_r($_SERVER);print("</pre>");Any help or ideas would be greatCheers Link to comment https://forums.phpfreaks.com/topic/34577-transforming-href-attribute-to-url/ Share on other sites More sharing options...
Case-Sensitive Posted January 17, 2007 Author Share Posted January 17, 2007 Im guessing no one replied because of the stupidness of this post. I just realised how Stupid it was (not me)! After thinking about it, it was a useless post, which created more server processing thus adding additional carbon emissions to the atmosphere (apologies to your children)If all sites start at root, all i had to do was prefix the url (that was given at the beginning) of the site to the href attribute:[code]$url_to_test="http://www.example.com/";$href = "about.html";[/code]then concatenate the strings, so it would give a well formed url: "http://www.example.com/about.html":[code]$url_to_test.$href;[/code]Sorry Guys Link to comment https://forums.phpfreaks.com/topic/34577-transforming-href-attribute-to-url/#findComment-163191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.