SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Bulgaria
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to get posted text using PHP

    Hi ... I'm still a newbie using PHP. I developed a site that uses a lot of quotes i.e. USD, EUR, CHF and most of the shares traded in our country's stock market. But I experience troubles because I have to update every day the quotes ... and beleive me it's boring ! Although the admin panel I created is user friendly and fills automatically most of the information like the date for example ... I am still looking for another solution of the problem.

    Is it possible PHP automatically to get values posted somewhere else ... like the Bulgaria's Stock Exchange Website. The quotes there use an internal database and are generated automatically within the daily trading offers. It will be very usefull if i can get my quotes directly from it's website.

    If anyone can help me ... I will be very gratefull !

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    London
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may want to look at using curl that will enable you to do what you want but its not the most newbie friendly set of functions.

    If you check the php manual for curl you will see that this is just the type of thing it is designed to do.

    Alternatively, you can use fopen and fgets to read the webpage in and look for a known tag eg the stock name and just use explode() on that to get your value.

    Another possibility would be to see if they offer an xml/rss/atom feed which would be much easier to parse.

    Let us know if any of these ideas sound like the sort of thing you are looking for and we will see if we cna offer anymore help.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Bulgaria
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    re:

    Thanks ...
    and OH MY GOD ... at first I thought that drawing graphics from a DB values was hard to achieve ... but this (i mean curl) is way beyond any understanding. Never mind - I'll give it a try anyway ...
    fopen is easyer i think ... but I have to read all the stuff before i decide which one to use.
    About the xml/rss/atom feed ... the whole stock exchage here is so lame ... I was surprised that they have webpage at all.

    Anyway ... I am sure that I'll need more help ... assuming that I am using PHP for no longer than a month.

    Lots of thanks again ! Thank you for the concern !

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    well there's a business opportunity if ever I saw one!!!!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Bulgaria
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    re: again

    Hi again ... I can use some more help if you are willing to reveal some more php secrets to me
    OK ... finally i got some spare time for experiments.
    The "curl" unfortunately was not supported in both my PC's LOCALHOST and the website real HOST.
    In "Extensions" directory of my php i found the "php_curl.dll" file so i activate the extension in "php.ini" file!
    After the restart I was overflowed with error messages for missing dlls.
    After some real affords to make it work I decided to stop trying.
    Unlike "curl" it was easy to retrieve some info using "fopen".
    The result was quite large flow of information which I cannot use.
    The first thing I thought of was something like "trim" but it certainly was not the function i needed.
    Can you tell me how to extract the information i need ?
    Or can you give some hint how to make curl to work with me ?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •