Jump to content

Recommended Posts

Hi All,

I've been threw ALOT in the web business but now im totally lost, hope sum1 can lend me a hand in here.

the situation is:

i'm developing a website using joomla, in that website there'll be a block which contains the "Stock's Share Price" for the company. the thing is, it's an egyptian company, so yahoo finance doesnt have its info on it, so the only way to make the share price live updated on my website is to screen scrape the original page to mine

 

original page:

https://www.arabfinance.com/MarketStatistics/Quotes.aspx?Id=1725

 

so, any way to extract the " Last Price - Net Change - % Change - Volume - Currency " Date To Another HTML File???

 

Link to comment
https://forums.phpfreaks.com/topic/135359-screen-scraping-freaky-code/
Share on other sites

This is quite simple but you are better setting a cron job to grab the data in given intervals rather than requesting live from your site page. The remote site will end up banning your IP if traffic is high and your page load time could be slowed if the remote site is busy.

 

In your script

Use CURL to grab https://www.arabfinance.com/MarketStatistics/Quotes.aspx?Id=1725

Then simply use regular expressions to extract the data you require from the HTML. Save the extracted data to your website database.

 

Your website can then display the data from your database.

 

Easy

If you don't have access to cron jobs, however, you could store the values you retrieve in a database then compare the current time with the last time it was retrieved and see if you need to go get the up-to-date info.  You'll still be stuck with the slow load time, however.

 

Another option would be to use an iframe to load a separate php file (possible through AJAX) that does nothing but pull the information and display it.  That way your page will load quickly and just the stock price will take a minute to display.

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.