Closed Thread Icon

Topic awaiting preservation: Send a POST request to a script from another script Pages that link to <a href="https://ozoneasylum.com/backlink?for=12984" title="Pages that link to Topic awaiting preservation: Send a POST request to a script from another script" rel="nofollow" >Topic awaiting preservation: Send a POST request to a script from another script\

 
Author Thread
Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 11-16-2003 08:20

Friend was looking for an answer to this, i didn't have one so figured I'd see if you did

"I'm trying to have one script send another one a POST request, this doesn't seem to work, but i don't see whats wrong."

code:
$data="test=sometexttext";
$data=urlencode($data);
$fp = fsockopen("www.site.com", 80);
fputs($fp, "POST /home/user/public_html/folder/file2.php HTTP/1.0\r\n");
fputs($fp, "Host: [url=http://www.site.com\r\n");]www.site.com\r\n");[/url]
fputs($fp, "Content-type: application/x-www-url-encoded\r\n");
fputs($fp, "Content-length: ".strlen($data)."\r\n");
fputs($fp, "\r\n");
fputs($fp, $data."\r\n");
fputs($fp, "\r\n");
fclose($fp);


This is all the information I was given and I didn't know enough about it to ask for anything else, if you need more info on something directly I can always ask about it though

As always any help is appreciated, thanks in advance

[This message has been edited by Synthetic (edited 11-16-2003).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 11-16-2003 09:35

The script doesn't work because you're passing local file name of target script as URL.

This line should be changed:

fputs($fp, "POST /home/user/public_html/folder/file2.php HTTP/1.0\r\n");

To the actual URL (relative to w&#119;w.site.com), like "/folder/file2.php"...


Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 11-16-2003 21:34

Thanks

Synthetic's Chess Player Page

« BackwardsOnwards »

Show Forum Drop Down Menu