0
   

PHP question about parse_url

 
 
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.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 3,076 • Replies: 1
No top replies

 
Thomas
 
  1  
Reply Sat 5 Jun, 2010 04:42 pm
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?
0 Replies
 
 

Related Topics

\n - Question by negikaithal
What does \n mean in PHP Code? - Discussion by roverroad
PHP Debate - Discussion by Craven de Kere
PHP: Cookie Problem - Discussion by BobbyDouglas
Installing PHP with IIS - CGI Error - Discussion by skinnz
Displaying <?php in javascript. - Discussion by BobbyDouglas
php software - Question by aishna
 
  1. Forums
  2. » PHP question about parse_url
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 12/26/2024 at 04:21:33