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 06-19-2010, 05:03 AM Is this possible??
Novice Talker

Posts: 4
Name: One SOFAZR
Trades: 0
Greetings guys..

Is it possible to copy text/number/figure from HTML Table to PHP or other Scripts? The HTML text/figure/number is from other web/server.

Something like this..
X - is figure from others web/server
Y - is from my own web/server

I want get X & add some math calculation & display it at Y.
Possible?
__________________

Please login or register to view this content. Registration is FREE
nvxdesign is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-19-2010, 07:07 AM Re: Is this possible??
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
If you want to get info from another website then you will have to scrape it

Unless the other site offers the data up through an API

You should look at using cURL in php
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-19-2010, 08:31 AM Re: Is this possible??
Super Talker

Posts: 143
Trades: 0
This is something really complicated
itbuzz is offline
Reply With Quote
View Public Profile
 
Old 06-19-2010, 10:51 AM Re: Is this possible??
Novice Talker

Posts: 4
Name: One SOFAZR
Trades: 0
Quote:
Originally Posted by davidj View Post
If you want to get info from another website then you will have to scrape it

Unless the other site offers the data up through an API

You should look at using cURL in php

Thx for replying.. btw, there is no API
How do i "scrape" it?
fyi: the figure that i want grab from another site is PRICE which is in HTML Table & i want to display it at my site but with some additional amount.
__________________

Please login or register to view this content. Registration is FREE
nvxdesign is offline
Reply With Quote
View Public Profile
 
Old 06-20-2010, 11:32 PM Re: Is this possible??
famouscrew's Avatar
Average Talker

Posts: 17
Name: Lindsay Farm
Trades: 0
I don't get it. Is that possible? Getting HTML text from other server.
famouscrew is offline
Reply With Quote
View Public Profile Visit famouscrew's homepage!
 
Old 06-21-2010, 12:40 PM Re: Is this possible??
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by famouscrew View Post
I don't get it. Is that possible? Getting HTML text from other server.
You were doing exactly that when you read this thread!

Browsers do it all the time, as do search engines.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-21-2010, 10:33 PM Re: Is this possible??
badams's Avatar
Skilled Talker

Latest Blog Post:
Dum Skype Firefox plugin
Posts: 69
Name: Barry Adams
Location: London
Trades: 0
This is easy, first load the file from the remote server, pattern match it for the correct table,

PHP Code:
$page file_get_contents($url);
  
$tables = new Array();
  
preg_match_all('/<table>(.*?)</table>/x',$page,$tables);
  
$mytable $tables[0][1]; // or the 0 to (n-1)th table on the page
  
$rows = new Array();
  
$mydata = new Array();
  
preg_match_all('/<tr>(.*?)</tr>/x',$rows);
  
$r =0;
  foreach(
$rows as $row){
    
$tds = new Array();
    
preg_match_all('/<td>(.*?)</td>/x',$row[0],$tds);
    
$c 0;
    
$mydata[$r]= new Array();
    foreach(
$tds as $td){
       
$mydata[$r][$c++] = $td[1];
    }    
  } 
So you now have the table's data in the 2d array, $mydata.
Process this and make you page.
__________________

Please login or register to view this content. Registration is FREE
@
Please login or register to view this content. Registration is FREE
(320+ Subjects)
badams is offline
Reply With Quote
View Public Profile Visit badams's homepage!
 
Reply     « Reply to Is this possible??
 

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.60590 seconds with 12 queries