Jump to content

how to copy from a website


ctcp

Recommended Posts

You could use fopen or php curl to read in the pages.

 

From there you could use strpos or a variety of other items to get the text you want.

 

Here is the code you could use for a twitter feed..

<?php
$twitter_name = "phpfreaks";
$twitter_max = 5;

$doc = new DOMDocument();
$doc->load('http://twitter.com/statuses/user_timeline.rss?screen_name='.$twitter_name);
$twitter_counter = 0;

foreach ($doc->getElementsByTagName('item') as $node) 
{
//get the title and url of the twitter post
$title = $node->getElementsByTagName('title')->item(0)->nodeValue;
$url = $node->getElementsByTagName('link')->item(0)->nodeValue;
$twitter_search_name = $twitter_name.": ";
$pos = strpos($title, $twitter_search_name);

//verify that the twitter post contains
if ($pos !== false)
{
	if ($pos == 0)
	{
		if ($twitter_counter < $twitter_max)
		{
			$title = str_replace($twitter_search_name,"", $title);
			echo "<a href=\"$url\" target=\"_blank\">$title</a><br />\n";
			$twitter_counter++;
		}
	}
}

if ($twitter_counter >= $twitter_max)
	break;
}
?>

how to copy from a website specific piece of txt  and insert to mysql

the easiest way is in 5 steps

1) to place your mouse pointer at the beginning of where you want to copy, hold the left click and drag the mouse over the text you want to copy and stop at the end of where you don't want the text anymore.

2) Release the mouse, you should see the text highlight, make sure that all the text you want.

3) press and hold Ctrl and press letter C at same time.

4) go to your mysql database table and place the mouse where you want to paste the text to.

5) press and hold Ctrl and press letter V...

Done

forgive me, if that's not the way you want to do it... it's just one of the possibilities :D

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.