I want to fetch data from live stock market to my web site. By using php and jQuery.
Has the source got an API you can work with to fetch the data? If so read their docs and implement it.
If not you could possibly do a Curl request and parse the data you need if your allowed.
More importantly you need to be more specific with your question if you want to get good answers, if any at all :-).
You need to find a web service that offers a stock market feed in the form of JSON or XML, so that your computer would be able to parse it. Not a website. Most of those feeds are paid - especially those that are close to real-time.
Then, once you have such a feed, you should be able to access it via your browser - just by typing in the URL. For example, http://www.quotewebsite.com/symbol=MSFT
This will help you understand what your server side script is supposed to do. Then, in your PHP script (PHP is a server-side programming language), issue a CURL request to download that specific page into your website's database (ex. MySQL). This will allow you to have historical data inside your own system. Then you get to render that data back to your own customers by querying your own database.
Related
I just need to show my own music on my website. So mine is not an "app" which other users will use. I simply want a PHP script that queries Spotify from time to time, perhaps once every day, and finds if there's a new song added to my playlist. If so, it adds that to my website and shows it on my site.
For this I'd like a very simple script that allows me to authenticate myself in a server side code (which will be executed via cron) and bring back all the tracks in a specific playlist. I'd prefer not to use any library etc, just plain PHP code.
But I'm not sure which 'Authorization API' here I should use. Curl is just for testing, yes? Not for actual code especially with GET as that would be insecure? Would appreciate any pointer to any code sample for this. Thank you.
As i have small requirement regarding tracking information from different parts of a flash file using php mysql. Means in a flash game i will be having preloader part, more games button and logo inside the game. As i want to track that how many clicks are getting from these places using php mysql. Can anyone give me any ideas.
Use the URLRequest/URLLoader classes of ActionScript to send a request to your website. Parse the request with PHP, extract the GET or POST variables and insert them into your database.
I would like to grab data from a certain website periodically (every 2-3 hours).
Website is weather related: http://meteo.gov.ge/index.php?l=2&pg=cm&ct=1&cm=
They also provide widget: http://meteo.gov.ge/index.php?pg=sb but I need something more personalized on my webpage... I only need to grab temperature in number and weather icon for any city.
On my ubuntu: I would probably try to use curl + grep/regex and cron it.
But how would I do that in php? Can I use in anyway the fact that they provide widget (I doubt, since it is embedded in image)?
p.s. this is not content stealing, it is a gov site thus financed by my (tax payer) money! I should be able to grab data I need, from service I pay for >:)
Tipically this kind of weather services offer RESTFUL web services (API) to get data:
You execute an http GET or POST providing some parameters (for example the name of the city you want to retreive weather forecasts) and they send you a piece of xml with the detailed forecasts.
Then is up to you to parse the returned xml and disply only the info you want.
I absolutely discourage you to grub the entire html content of the homepage of the weather site you shared.
Image they suddently change the structure of the page,dimensions and so on, your code will fail.
You need a structred way to get the forecasts, this is why API exists. If the site doesn't provide you API try to search another weather forecast site for your country!
Scenario -> Website which uses javascript to track users. This is for traffic analysis.
Problem -> Some people posting the data using bots and curl in php.
Wanted solution -> Only allow legitimate users statistics to be counted in the analysis.
Problem -> Some people posting the data using bots and curl in php.
cURL doesn't execute JavaScript, nor does it fetch image assets, so it won't be counted in analytics collected with either of those methods.
I am creating a custom reporting website, where I want to show live data from google analytics and accordingly the data in my website will change. I want it to be automated and dynamic, like whenever the data changes in GA, i want it to be automatically changed in our website, which will be shown to our clients to show the performance of our websites.
I am guessing this can be achieved by some api calling from php, xml returned values and showing those data on our website along with images.
i would appreciate if anyone could give me more info on how to start working on this.
Google Analytics has an official API. They don't seem to have ready-made PHP examples, but the XML sources should be easy to query. Not sure how "live" GA's data is, though - it could be that it is not possible to do stuff live tracking of visitors.