Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-16-2007, 11:51 AM PHP And Other Sites
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
Is there a way to get information of other sites if it aint an rss feed?
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
 
Register now for full access!
Old 08-16-2007, 12:03 PM Re: PHP And Other Sites
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
There was no need for another thread. It is the same process I outlined in the previous thread, all you need is a different parser be it XHTML, RSS, Atom, Plain text etc. etc.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
Reply With Quote
View Public Profile Visit JamieLewis's homepage!
 
Old 08-16-2007, 12:28 PM Re: PHP And Other Sites
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
ye i no but i posted in graphics forum by accident!
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 08-16-2007, 12:37 PM Re: PHP And Other Sites
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
This works but i dunno how what to put in the parse function for example:

Main Code:

PHP Code:
<?php 
function parse($html, &$title, &$text, &$anchors)
{
  
$pstring1 "'[^']*'";
  
$pstring2 '"[^"]*"';
  
$pnstring "[^'\">]";
  
$pintag   "(?:$pstring1|$pstring2|$pnstring)*";
  
$pattrs   "(?:\\s$pintag){0,1}";

  
$pcomment enclose("<!-""-""->");
  
$pscript  enclose("<script$pattrs>""<""\\/script>");
  
$pstyle   enclose("<style$pattrs>""<""\\/style>");
  
$pexclude "(?:$pcomment|$pscript|$pstyle)";

  
$ptitle   enclose("<title$pattrs>""<""\\/title>");
  
$panchor  "<a(?:\\s$pintag){0,1}>";
  
$phref    "href\\s*=[\\s'\"]*([^\\s'\">]*)";

  
$html preg_replace("/$pexclude/iX"" "$html);

  if (
$title !== false)
    
$title preg_match("/$ptitle/iX"$html$title)
             ? 
$title[1] : '';

  if (
$text !== false)
  {
    
$text preg_replace("/<$pintag>/iX",   " "$html);
    
$text preg_replace("/\\s+|&nbsp;/iX"" "$text);
  }

  if (
$anchors !== false)
  {
    
preg_match_all("/$panchor/iX"$html$anchors);
    
$anchors $anchors[0];

    
reset($anchors);
    while (list(
$i$x) = each($anchors))
      
$anchors[$i] =
        
preg_match("/$phref/iX"$x$x) ? $x[1] : '';

    
$anchors array_unique($anchors);
  }
}

function 
enclose($start$end1$end2)
{
  return 
"$start((?:[^$end1]|$end1(?!$end2))*)$end1$end2";
}
echo 
parse("http://www.bbc.co.uk","","","");
?>
PHP Code:
 <?php echo parse("http://www.bbc.co.uk","","",""); ?>
I tried that but got this error

Fatal error: Only variables can be passed by reference in /home/champion/public_html/test/test/index.php on line 49

I dunno what the $title, $text, $anchors is meant to be?

http://www.php-development.ru/php-sc...tml-parser.php

Last edited by evans123; 08-17-2007 at 03:17 AM..
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Old 08-17-2007, 07:20 AM Re: PHP And Other Sites
evans123's Avatar
Ultra Talker

Posts: 468
Trades: 0
the script works on the site but it doesnt when i use it what am i doing wrong?
evans123 is offline
Reply With Quote
View Public Profile Visit evans123's homepage!
 
Reply     « Reply to PHP And Other Sites
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48668 seconds with 12 queries