Jump to content

Code Example That Doesn't Work.


supertrucker

Recommended Posts

I found this example on another website (here). I added only a couple things to it, to make it work the way I wanted to, but it doesn't get past "Line 4". The error I receive is:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /hermes/bosweb/web237/b2379/sl.supertru/public_html/zerorubbish/extract.php on line 4
I double checked my php.ini file, and "allow_url_fopen = On". I'm sure that I'm doing something really silly here, but my brain is tired. Any ideas?
<?php//$url = $_REQUEST['URL'];$url="http://example.com";$fp = fopen($url, "r");$content = "";while( !feof( $fp ) ) {$buffer = trim( fgets( $fp, 4096 ) ); $content .= $buffer;}$start = '<title>'; $end = '<\/title>';preg_match( "/$start(.*)$end/s", $content, $match ); $title = $match[ 1 ];$metatagarray = get_meta_tags( $url ); $keywords = $metatagarray[ "keywords" ]; $description = $metatagarray[ "description" ]; $nURL="http://zerorubbish.com/submitlink.php?EditMode=0&LinkAddress=$url&LinkName=$title&LinkDescription=$description"; header("Location: $nURL");?><html><head><title>Extract.php</title></head><body>Test.</body></html>

Link to comment
Share on other sites

Ok, this makes no sense. With the exception of one or two lines that were "//" out, I decided to retype the entire example by hand instead of copying and pasting. The script ran flawless! Is it possible, and I ask because it made a difference, that the "$" in his example, and the "$" in my example were different? I started changing punctuation such as the dollar signs one at a time (by retyping them) and the errors finally changed, moving on to the next one. All punctuation, that I replaced with the identical symbol.I don't get this one, I mean I do, because it's fixed, but I still don't understand why!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...