View Full Version : Run the file from PHP?

03-02-2010, 07:02 PM
Hello friends,

I am working on some project related to Indian Stock exchange.

I have a feed URL http://nseindia.com//marketinfo/equities/ajaxGetQuote.jsp?symbol=MARUTI&series=EQ

I know I can use Ajax to run this URL and fetch the data BUT I don't want to do it this way.

Rather, is there any way that I can run this URL from PHP script and store the result into PHP array?

I don't want to use JavaScript or Ajax for this.

03-02-2010, 07:07 PM
Look for some examples using curl (http://php.net/manual/en/book.curl.php). You can read that data pretty easily.

03-02-2010, 07:17 PM
Any specific information on how to install it?

03-02-2010, 07:34 PM
Doesn't file_get_contents (http://php.net/file_get_contents)() suit for you to get the output?

03-02-2010, 08:28 PM
Doesn't file_get_contents (http://php.net/file_get_contents)() suit for you to get the output?

Exactly what you want, BUT its only usable via HTTP if allow_url_fopen is enabled (which I believe it is by default). If disabled, curl is the way to go.

As for installing curl, if you're on you're own server, there is a quick installation guid on the api: http://www.php.net/manual/en/curl.installation.php
If you're hosted, thats likely already enabled since its a commonly used extension.