I am fairly new to PHP so this might not make sense to some people, but here it goes.... I am wanting to make a script where a user enters their username of a website, which will then display their profile - e.g. www.website.com/username Let me use Facebook as an example, this is what I want to do: Please enter your Facebook profile name: [entry box]bob2010[/entry box] [SUBMIT BUTTON] Code (markup): Upon the user entering their facebook profile username, I want the page to bring up http://www.facebook.com/bob99 - maybe in an iframe or something, so that they remain on my website. This isn't precisely what I want to do, but this is easier to explain - and hopefully any answers you have for me will help! What I actually want to do is link to http://www.website.com/[user name entered by visitor]/the-rest-of-the-url Thanks
With: <form action="script.php" method="post"><input type="text" name="username" /><input type="submit" /></form> HTML: And: <?php if(isset($_POST['username'])) { $url = 'http://www.website.com/' . urlencode($_POST['username']) . '/the-rest-of-the-url'; header('Location: ' . $url); // This redirects } ?> PHP: Maybe? Regards.
Thanks - this is kind of what I mean However, I want the script to display information on the page, independent of the other site. So, sticking with our facebook example, instead of just redirecting to the profile page of the user name submitted, how can I get the script to scan the profile page for other user profiles, and display it in a table? For example, say on facebook, I want to gather the profiles of everyone who has written on my wall, how can my script scan the http://www.facebook.com/bob99 profile page, and display all the other users who has written on his wall in a list? The common URL would be: http://www.facebook.com/profile.php?id=99999999 - for example
That's much more advanced. You need to use file_get_contents() or cURL to get the source of the page and grab the data using regex.
I think you would definately want to use an iframe for this. Don't think that getting the contents of the page will do you any good since it would cause problems any time there is a local reference. Iframe's are fairly simple to use too: http://www.w3schools.com/tags/tag_iframe.asp