Computing.Net > Forums > Web Development > PHP and Sockets

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP and Sockets

Reply to Message Icon

Name: Spinal
Date: April 6, 2005 at 04:00:21 Pacific
OS: NA
CPU/Ram: NA
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Jamie_McCoy
Date: April 6, 2005 at 08:09:51 Pacific
Reply:

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

roamhosting.net


0

Response Number 2
Name: Jamie_McCoy
Date: April 6, 2005 at 08:11:33 Pacific
Reply:

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 ?

roamhosting.net


0

Response Number 3
Name: anonproxy
Date: April 6, 2005 at 19:46:31 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP and Sockets

PHP and MYSQL help www.computing.net/answers/webdevel/php-and-mysql-help/1317.html

.php and windows www.computing.net/answers/webdevel/php-and-windows/2307.html

PHP and Apache2 www.computing.net/answers/webdevel/php-and-apache2/7.html