Current location: Hot Scripts Forums » Programming Languages » PHP » PHP, iFrame and Joomla?

PHP, iFrame and Joomla?

Reply
  #1 (permalink)  
Old 06-14-09, 03:39 AM
TrueFact's Avatar
TrueFact TrueFact is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP, iFrame and Joomla?

Hi all,

I have a site based on Joomla CMS which is about Forex. I want to offer my visitors several analysis and services. One of these is to give them an alert when one or more currencies reach a certain price.

I use ForexPros WebMaster tools to get the currency cross rates in realtime. For that they've made an iFrame and made it available here.

I need the bid level only for four sets of currency cross rates, thus the iFrame should be as follows:

HTML Code:
<iframe frameborder="0" scrolling="no" height="102" width="151" allowtransparency="true" marginwidth="0" marginheight="0" src="http://fxrates.forexpros.com/index.php?pairs_ids=1;2;3;4;&header-text-color=%23FFFFFF&curr-name-color=%230059b0&inner-text-color=%23000000&green-text-color=%232A8215&green-background=%23B7F4C2&red-text-color=%23DC0001&red-background=%23FFE2E2&white-text-color=%230059B0&inner-border-color=%23CBCBCB&border-color=%23cbcbcb&bg1=%23F6F6F6&bg2=%23ffffff&bid=show&last=hide&open=hide&high=hide&low=hide&change=hide&change_in_percents=hide"></iframe><br /><span style="font-size: 11px;color: #333333;text-decoration: none;">Cross Rates Powered by <a href="http://www.forexpros.com/" target="_blank" style="font-size: 11px;color: #06529D; font-weight: bold;" class="underline_link">Forex</a> Pros - The Forex Trading Portal.</span>
This was all about the my source for the cross rates. Now, I want to implement this into my site that I can compare the current bidding level against another value that I will set and update manually weekly. When the bidding level reaches the manual value at anytime, an alert of any kind to the user should be displayed.

That's the story, now my question:
- How can I extract the values from the iframe? noting that these values are dynamic ones

I can take care of converting the code into Joomla! module or component, so that should be no problem, for now at least. Also no need for me to keep their formatting, as when putting the code into Joomla modules and/or components, I have to make a template for it output (as joomla uses Model-View-Controller pattern)

Thank you in advance...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-14-09, 03:22 PM
Jcbones Jcbones is offline
Coding Addict
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 269
Thanks: 3
Thanked 3 Times in 3 Posts
You will have to scrape the page in the Iframe to get those values. This would require two things.

Permission from Forexpros,
and regular expressions.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-20-09, 06:54 AM
TrueFact's Avatar
TrueFact TrueFact is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Permission from ForexPros finally granted.... and now only the code is remaining...

Is there any suggestions out there?!

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-20-09, 10:24 AM
Jcbones Jcbones is offline
Coding Addict
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 269
Thanks: 3
Thanked 3 Times in 3 Posts
PHP Code:
<?php
$url 
'placeThatHugeUrlHere';

$file file_get_contents($url);
if(!
$file) echo 'Error, cannot read file';

preg_match_all('/<td[^<]+>[0-9]+\.[0-9]+/',$file,$match);


echo 
$match[0][0] .'= EUR/USD Bid<br/>'.
$match[0][1] .'= EUR/USD Ask<br/>'.
$match[0][2] .'= GBP/USD Bid<br/>'.
$match[0][3] .'= GBP/USD Ask<br/>'.
$match[0][4] .'= USD/CHF Bid<br/>'.
$match[0][5] .'= USD/CHF Ask<br/>'.
$match[0][6] .'= USD/JPY Bid<br/>'.
$match[0][7] .'= USD/JPY Ask<br/>';



?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
dynamic value, iframe, joomla


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump


All times are GMT -5. The time now is 01:11 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.