How to get info from another website and post it on mine?

Hello, I am new to PHP and am trying to learn how to do something.

Here is what I am trying to do:

I am trying to make a form (HTML form, I know how to do that already), when someone types a name in the form. It will post that name at the end of the url, and get the information from the url.

Here is an example:

I type in “Mr Travis L” (no quotes) in a HTML Text Field. After I do that, it will put the “Mr Travis L” to the end of this url: http://hiscore.runescape.com/index_lite.ws?player=

So it would now be: http://hiscore.runescape.com/index_lite.ws?player=Mr Travis L

After it does that, I want it to get the information (the numbers) from that url, and post it on my website.
How would I do that!? I have tried everything I could think of but nothing works!

Please if anyone could help me it would be so much help!
I am also sorry if this is in the wrong forum section :frowning:

Hi, and welcome to our forum.

Here is how you can do this. Let’s combine your HTML form with PHP script:

[php]

<?php $username = urldecode($_POST["username"]); $info = ''; if($username!=''){ $info = implode('',file('http://hiscore.runescape.com/index_lite.ws?player='.urlencode($username))); } ?> Enter user name: <?php if($info!=''){ echo '

Results for '.htmlspecialchars($username).'


'; echo '

'.$info.'

'; } ?> [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service