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;
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.