Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello! I am trying to write a PHP script that logs into a website, collects a table of information and then processes it. I have managed to do everything, but I cannot figure out how to make the server log into the third party site. I have tried this:
<body onload="javascript:document.forms[0].submit();">
<form action="http://www.thirdSite.com/login.php" method="post">
<input type="hidden" name="usrname" value="name">
<input type="hidden" name="uemail" value="email">
<input class="login_input" type="password" name="password" value="password">
<input type="hidden" name="hash" value="fd9044d39b69421805713d18c0f265a5">But, obviously, that logs in the browser it is being accessed from. I tried fiddling with sochets, but hit several walls. Can anybody help me here? All I need is to get the server (preferrably via php) to log into the thirdSite usign the 4 variables shown above.
Thanks
Spinal

i take it your going to get it to automatcally submit, meaning a user does not have to actually click submit ?
how are you goin to do that

ah sorry so your using a java method for the second submit
so you want a user to enter 1 set of details, and be logged into 2 websites at the same time ?

No no. He wants to simulate a series of HTTP transactions in his script and then extract data from the resulting HTML document (or scrap the page).
Two ways:
- I would dissect the target login page and construct a POST message that mimics that. This would require a regular socket connection. Check out the PHP manual for fsockopen and use the sample code. The common way is to simply use a loop to collect the full contents of the return document. You can also use cURL, if that's supported by the host (more abstract than normal sockets).
- You might grab a browser class for PHP, if you want something more highlevel. There are a couple - PEAR has one called HTTP client. Check Google for a tutorial on this.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |