/    Sign up×
Community /Pin to ProfileBookmark

Fetch records from third party website

Hi

There is a scenario where there is an HTML form on some website (say [url]http://xyz.com/user.php[/url]), which prompts for username. When you enter the username and click on “Submit”, using the POST method it takes you to the same page (user.php), queries the DB and then redirects to that user’s profile ([url]http://xyz.com/profile.php?profile=55412256[/url])

Please note that in the above querystring, 55412256 is NOT the username that you input in the first page, its probably an autoID or something else, so please do not get confused.

The profile.php page includes User’s Firstname, Lastname, Date Of Birth.

The html format for the same is:

[CODE]<table border=”0″ width=”100%”>
<tbody>
<tr>
<td><h1>Member details</h1></td>
</tr>
<tr>
<td><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Name: </strong> <span id=”Name”>Mr John Smith </span><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Date of Birth: </strong> <span id=”DOB”>31 Oct 1982 </span><br>
<br>
</td>
</tr>
</tbody>
</table>

[/CODE]

Now, my question is that, since I do not have the DB access to that website, so is there anyway I can automate this system in my application and fetch a user’s Date of birth?

What I mean is, people come to my website, enter their username and get their date of birth. I know this is pretty pointless but this is what I need ?

I don’t know how but I have a strong feeling that this can be done.

Please assist ?

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@themartyMay 15.2009 — So basically, what you want to know is how you can post a value to an external website and grab a specific part of the content it returns?

Since there's a redirect, file_get_contents() might not work. In that case you need to use something like cURL

This will get you the contents of the website. After that it's just a matter of getting the DOB with a regular expression
×

Success!

Help @phantom007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...