Retrive data from website to database using (CURL)

Discussion in 'PHP' started by remo333, Feb 28, 2013.

  1. #1
    hey guys please help me here;

    I want to create a database that collects daily temperature (specific location) data at a certain time of the day
    from the Met office website.( or any other weather website ) and present it in a excel spread sheet.

    i was planning on using CURL to retrive the data, any suggestions on how to do it?


     
    remo333, Feb 28, 2013 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Have you checked the CURL page on PHP.net? (http://php.net/curl)

    If yes? what's your question then? i don't see any real question here...
     
    EricBruggema, Feb 28, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Once you get it using CURL, you'd need to parse the page -- some people might go for trying to use a regex, I'd suggest taking a look at PHP's DOMDocument handler to try and parse the data out that way.
    http://www.php.net/manual/en/domdocument.loadhtml.php

    Apart from that, Eric's right, not really seeing a question here.
     
    deathshadow, Mar 2, 2013 IP
  4. kingofdollars

    kingofdollars Well-Known Member

    Messages:
    97
    Likes Received:
    12
    Best Answers:
    1
    Trophy Points:
    110
    #4
    My suggestion is that, once you get the content from the Met's site, regular expression might be the best way to try. It depends of what kind of data u want.

    Timing is done by cron job from your server anyway.
     
    kingofdollars, Mar 3, 2013 IP
  5. Zinosi

    Zinosi Well-Known Member

    Messages:
    75
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    118
    #5
    You can also use file_get_contents('http://yoururl.com')
    This way you don't need to learn curl. Although curl is easy to learn but using the above code is an easier alternative.
     
    Zinosi, Mar 4, 2013 IP
    blackhunter250 and seage212 like this.