1.

Solve : How to include data from other ftp site??

Answer»

I wish to display a part of numerical data from a ftp site into my WEBSITE ( phpbb3) http://earth-station-forum.stationforum.com/ .

How do I do that?

Enclosing the whole page is easy but how to reproduce only a small data?

In particular how can I reproduce only the bold text "Solar flux = 83 " form the webpage :http://www.swpc.noaa.gov/ftpdir/latest/wwv.txt

Quote



:Product: Geophysical Alert Message wwv.txt
:Issued: 2010 Sep 21 0906 UTC
# Prepared by the US Dept. of Commerce, NOAA, Space Weather Prediction Center
#
# Geophysical Alert Message
#
Solar-terrestrial indices for 20 September follow.
Solar flux 83 and mid-latitude A-index 2.
The mid-latitude K-index at 0900 UTC on 21 September was 2 (18 nT).

No space weather storms were observed for the past 24 hours.

No space weather storms are expected for the next 24 hours.

I am not a professional software PERSON ... but have attempted a few complex programs in C BASIC etc.

Just a very preliminary code will do .. I will try to refine it.

I tried $string.. $ SUBSTR etc but could not succeed.

Thanks in advance.

==========

S S SalviAre you happy with regex? If so perhaps use curl to fetch the HTML VIA HTTP, then regex the data out?

So:

Code: [Select]$connect = curl_init();
    curl_setopt($connect, CURLOPT_URL, 'http://pageurl.com');
    curl_setopt($connect, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($connect, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
    curl_setopt($connect, CURLOPT_POST, TRUE);
    curl_setopt($connect,CURLOPT_CONNECTTIMEOUT,2);
    curl_setopt($connect,CURLOPT_TIMEOUT,2);
    //curl_setopt($connect, CURLOPT_POSTFIELDS, 'Post content. Probably not needed');
    $response_content =  curl_exec($connect);
    $response = curl_getinfo($connect);
Then use a simple regular expression on $response to get the required data?Thanks TristanPerry,

Actually HTML, PHP  etc are all equally alien to me.

Regex is also same.

So I can just go to basics of it and try to adapt the code for my use.


Thanks for the input ...  will come back and REPORT the happenings .

=====
sssalvi


Discussion

No Comment Found