Reply
Sat 5 Jun, 2010 03:24 pm
I have a site that is using parse_url in this command:
<?php $domain = parse_url($row['buyfrom'], PHP_URL_HOST); ?>
buyfrom is a url and in this case the specific url I having difficulty with is very long:
http://www.target.com/Corningware-SimplyLite-10-pc-Casserole-Set/dp/B001A40S98/ref=sr_1_2?ie=UTF8&searchView=grid5&qid=1275771178&frombrowse=0&fromGsearch=true&node=1038576|1287991011&keywords=corningware%2010&searchSize=30&id=Corningware%20SimplyLite%2010-pc%20Casserole%20Set&searchBinNameList=purchasing_channel,subjectbin,price,target_com_primary_color-bin,target_com_size-bin,target_com_brand-bin&searchNodeID=1038576|1287991011&searchRank=target104545&sr=1-2&searchPage=1&rh=
I'm getting all kinds of errors. Is there a way to fix this command so that it can handle the long url like this one? I'm assuming the length of the URL is the issue.
Apparently, this line of code serves to extract the URL's domain. So why not precede it with a line that cuts off the URL after the top-level domain(".com" in this case), pass the so-tuncated url to to parse_url(), and see if the error messages go away?