Can you execute a post command from code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
icarpenter
Forum Commoner
Posts: 84
Joined: Mon Mar 07, 2005 8:12 am
Location: Kent, England

Post by icarpenter »

hedge wrote:Check out this link for some functions I wrote to do a POST using fsockopen viewtopic.php?t=7063 You could also use CURL or snoopy.
Thanks for that I tried...

Code: Select all

$fp = @fsockopen("//localhost", 80);
  if ($fp) {
    fputs($fp, "POST //localhost/mydirectory/index.php?test=test\r\n");
    fputs($fp, "Host: //localhost");
    fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
    fputs($fp, "Content-length: " . strlen(10) . "\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    fclose($fp);
But no banana!!!

I know this is wrong but would be great if you could push me in the right direction?
Post Reply