| 
	
 | 
 Posted by Jerry Stuckle on 03/03/07 02:52 
affiliateian@gmail.com wrote: 
>> I'm trying to help, but without the information I'm asking for, you make 
>> it almost impossible to give you a good answer. 
>  
> Hey Jerry, 
>  
> First of all, know that your help is really appreciated. Being a 
> newbie at coding, I am still trying to follow the lingo. Sorry about 
> missing some info. Let me try it here. 
>  
> Running this: 
>  
> <?php 
> $url=$_SERVER['SCRIPT_URI']; 
> $file=explode("/",$url); 
> $filename=$file[(count($file)-1)]; 
> echo $filename . "<br>\n"; 
> echo "<pre>\n"; 
> print_r(file($filename)); 
> echo "</pre>\n"; 
> //$content = implode('', file($filename)); 
> preg_match("/<title>(.*)<\/title>/i", $content, $match); 
> $title = $match[1]; 
> $link='edited-so-url-displays://www.stumbleupon.com/submit?url='. 
> $url.'&title='.urlencode($title); 
> ?> 
> <a href='<?php echo $link;?>'>Link to stumbleupon</a> 
>  
> Resulting HTML is: 
>  
> <a href='http://www.stumbleupon.com/submit?url=&title='>Link to 
> stumbleupon</a> 
>  
> Want to get this: 
>  
> <a href='http://www.stumbleupon.com/submit?url=http://www.mydomain.com/ 
> file.html&title=Title of file.html'>Link to stumbleupon</a> 
>  
> How was that? 
>  
 
OK, so look at your code and what's different between what you get and  
what you want? 
 
Two things.  First of all $url isn't displaying the correct info - so it  
must be incorrect.  What's in it?  echo before your code and I suspect  
you'll find it's empty.  So maybe $_SERVER['SCRIPT_URI'] is incorrect,  
Use print_r() to figure out what's in it. 
 
The next problem is $title doesn't seem to contain the correct  
information.  But that's ok because your implode is commented out. 
 
But notice that $filename in your implode() function call eventually  
comes from $url, also. 
 
Hmmm, two different problems, but both with the same source.  What do  
you want to bet $url doesn't have the information you want?  echo it to  
the display and see what it actually has. 
 
BTW - I agree with Geoff.  You need to develop some debugging  
techniques.  With some decent techniques you should be able to determine  
the cause of your problem in 10-15 minutes, instead of a couple of days  
trying to converse here on usenet. 
 
That's not saying I won't continue to try to give you a hand here.  But  
you're going to need those techniques the more you program. 
 
 
--  
================== 
Remove the "x" from my email address 
Jerry Stuckle 
JDS Computer Training Corp. 
jstucklex@attglobal.net 
==================
 
  
Navigation:
[Reply to this message] 
 |