TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-20-2009, 03:23 AM   #1 (permalink)
The Contributor
 
russellharrower's Avatar
 
Join Date: Jul 2009
Posts: 80
Thanks: 13
russellharrower is on a distinguished road
Default get all text in div

Hi just windering we need to get all the html code inside the following div using a php script

Code:
<body>
<div id="entry"></div>
</body>
the page is on another server, and we don't have access to the ftp and it changes every 2 hours, so I was thinking using a ping file that runs every 2 hours, (I would set that up in cpanel)

the file url looks like
http://www.example.com/blog.php

Thanks
russellharrower is offline  
Reply With Quote
Old 08-20-2009, 07:54 AM   #2 (permalink)
The Acquainted
 
Join Date: Oct 2007
Posts: 170
Thanks: 18
maZtah is an unknown quantity at this point
Default

Take a read on this one: http://nl.php.net/manual/en/function.file.php !
maZtah is offline  
Reply With Quote
Old 09-01-2009, 02:40 PM   #3 (permalink)
The Wanderer
 
gamer13's Avatar
 
Join Date: Sep 2009
Posts: 15
Thanks: 4
gamer13 is on a distinguished road
Default

Try this:

PHP Code:
<?php
$ch 
curl_init();

curl_setopt($chCURLOPT_URL"http://www.example.com/blog.php");
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);

$content curl_exec($ch);
if (
preg_match('/<div(.*?)>(.*?)<\/div>/is'$content$matches) {
    echo 
$matches[2];
} else {
    echo 
'Nothing found!';
}
So consider you have this page:
Code:
<html>
<head>
    <title>Some title</title>
</head>
<body>
    <div id="entry">Some random text</div>
</body>
</html>
Then the PHP script will output: "Some random text".
gamer13 is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
php/html form to echo text file contents Hustle Absolute Beginners 2 03-10-2009 07:14 AM
Text from Word-document Tanax General 13 02-06-2009 12:39 PM
Input-field with captured text falsely empties on click sidisinsane Javascript, AJAX, E4X 5 12-05-2008 12:12 AM
Need help editing/saving text files webosb Absolute Beginners 6 12-14-2007 06:43 PM
PDF Creation - Help! Sam Granger General 7 10-31-2007 11:32 AM


All times are GMT. The time now is 09:06 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design