0
FlyHiigh

How to embed a weather form on our Dropzone website?

Recommended Posts

Hi there,

We're trying to embed a form that is generated by awebsite

http://skydivingweather.co.uk, you type in your location, which in our case is 'Darlington' and it generates the weather in relation to Red, Green and Amber alerts.

Now when we type in Darlington and generate the form http://bit.ly/1ApQAfR we need need a way of embedding this in our website. I've tried to go to the source code and copy it over but all I get is the text.

Our website editing is all done in browser by a website builder, but it lets you imput html code.

Any help is greatly appreciated.

Share this post


Link to post
Share on other sites
I believe you need php code to grab the table.
Just copying the html code will give you the code for now, but tomorrow the forecast will change, but not your page because your html code is static.
Html code is like a book, each time you open it it will look the same.
Weather is not the same.

I'm on my phone now and can't look at the code on skydivingweather site, but most likely I have a finnished php code that can grab the stuff you want.

I have also made a weatherpage that grabs data from different sources and compiles it, I'm quite sure it can be used or modified to your needs

Share this post


Link to post
Share on other sites
Ok, this should work. IF your webspace host accept php.

Quote








$URL = file_get_contents('http://skydivingweather.co.uk/weather.aspx?t=351164&n=Darlington');

$text = get_Table($URL , "" , 0);
$text = str_replace("images/w", "http://skydivingweather.co.uk/images/w", $text);

echo $text . "

" ;

function get_Table($URL, $needle_begin, $needle_end, $offset)
{
$begin = strpos($URL, $needle_begin)+$offset;
$end = strpos($URL, $needle_end, $begin);
$URL = substr($URL, $begin , $end - $begin);
return trim($URL);

}


?>





And as you can see it's not that much code.
The actual php code is between . But the link-tag between the head tags are very important. If you copy paste it to a html code don't forget that line of code.


$URL is just as it sounds, the URL you wish to grab.
$URL is all the html code from the page as one string.


$text = get_Table($URL , "
" , 0);
This calls a function, the function is placed below the code.
The functions have four values. $URL, $needle_begin, $needle_end, and offset.
Don't bother about offset, it's just something I made for a different page.
The begin and end is first word and last word of the text you wish to grab.
As you can see I use .
If you look at the skydivingweathers source code, form and /form is beginning and end of the table.


str_replace replaces the short links the skydivingweather page uses to full links. Because you need full links on your page.

Echo $text will "paste" the html code from skydivingweather page from form to /form on your page.
. "
"; adds a on your page. Because the code in the function stops at , and not after.



And thats it.. hope you somewhat understand the code.

EDIT: You should contact the guy running the skydivingweather page and ask him if it's OK to use his data.
And provide a link to his page to show the source of your weather.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

0