GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP help needed. Any experts? (https://gfy.com/showthread.php?t=137386)

3Xguru 05-27-2003 04:49 AM

PHP help needed. Any experts?
 
I'm working on a script that fills out forms automaticaly.
The form url's are stored in a database, and I need to submit the variables to the forms using the post method.
The problem is that I do not know how to automaticaly submit the forms in php(without pressing a button for each form:))

The code would look something like this:
PHP Code:

<?php

for($i=1;$i<10;$i++){
$url_form="http://www.anotherserver.com/form".$i.".php";
$name="John";
}
?>

How do I submit the variable $name to all 10 external forms in the loop using the POST method?

Libertine 05-27-2003 04:51 AM

Open a socket connection, send the proper HTTP request, close the socket.

3Xguru 05-27-2003 04:54 AM

How do I do it? With the socket...
Can you post an simple example.
I have been trying to find a solution on Google for hours and my head hurts:(

Libertine 05-27-2003 04:55 AM

http://php.net/manual/nl/function.fsockopen.php
Read this.

Libertine 05-27-2003 04:57 AM

And here's an example from that page which might be helpful (no, I am lazy today, so I won't write you some custom code):

PHP Code:

//create a string with all the posted data...

foreach ($HTTP_POST_VARS as $key => $value) {
$value urlencode(stripslashes($value));
 
$req .= "&$key=$value";
}

//create headers...

$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= 'Content-Length: ' strlen($req) . "\r\n\r\n";
$fp fsockopen ('www.paypal.com'80$errno$errstr30);

if (!
$fp) {
 
// ERROR
 
echo "$errstr ($errno)";
} else {

//put the data..
 
fputs ($fp$header $req);
 while (!
feof($fp)) {
//read the data returned...
   
$res fgets ($fp1024);

}
 
fclose ($fp);



3Xguru 05-27-2003 05:08 AM

Thanks punkworld

You really helped me a lot!


All times are GMT -7. The time now is 10:56 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123