Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

Sylence

Community-Fossil

Beiträge: 1 663

Beruf: Softwareentwickler

  • Private Nachricht senden

51

09.06.2011, 16:42

Das ist doch in jedem PHP tutorial beschrieben. Les doch endlich mal eins.
Anstatt dem GET einfach das POST Array benutzen

Developer_X

Treue Seele

  • »Developer_X« ist der Autor dieses Themas

Beiträge: 247

Wohnort: Hessen

Beruf: Schüler

  • Private Nachricht senden

52

09.06.2011, 17:02

OK.
Ich habe das jetzt so gemacht :

C-/C++-Quelltext

1
2
3
4
5
6
7
    sf::Http::Request Request;
    Request.SetMethod(sf::Http::Request::Post);
    Request.SetBody(content);
    Request.SetURI("X/Mailer.php?user=developer_x&content=ss");
    sf::Http::Response s = http.SendRequest(Request);
    cout << s.GetBody() << endl;
    exit(0);


Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$value;
foreach($_POST as $key=>$value)
{
 if($value!='')
 {
  echo $key.': '.$value;
 }
}

echo $value;

$user = $_GET["user"];

$content = $_GET["content"];
$receiver = "x@hotmail.de";
$title = "Proposal from $user";
$headers = "Content-Type: text/html\n";

$v = mail($receiver, $title, $content, $headers);
?>

Als Ausgabe kriege ich nichts, außer einer leeren Zeile.

Warum?
Ich benutze doch beim C++ Code, SetBody, habe das Flag auf POST gesetzt, und beim PHP-Code mit $_POST gearbeitet, das auslesen lassen, und dann ausgeben.
- Die Zeit ist wie ein Fluss, und die Gegenwart wie ein Fels, der von dem Fluss der Zeit geschliffen wird. -
Kevin Riehl

53

09.06.2011, 19:53

Was enthält denn deine content Variable in C++?

Gruß
SaRu_

Developer_X

Treue Seele

  • »Developer_X« ist der Autor dieses Themas

Beiträge: 247

Wohnort: Hessen

Beruf: Schüler

  • Private Nachricht senden

54

09.06.2011, 20:14

C-/C++-Quelltext

1
2
<html><body><h1>Developer_X</h1><u><b>Proposals+:+1</u></b><hr><ol><li>Verbesser
ug+1</li></ol><hr><br></body></html>
- Die Zeit ist wie ein Fluss, und die Gegenwart wie ein Fels, der von dem Fluss der Zeit geschliffen wird. -
Kevin Riehl

55

09.06.2011, 21:18

Ähm.. hast du mal gegooglet, wie der Body-Teil eines HTTP Request aussieht?

Hier mal ein Auszug aus einem Google-Suchergebnis:

Zitat

The POST Method

A POST request is used to send data to the server to be processed in some way, like by a CGI script. A POST request is different from a GET request in the following ways:

There's a block of data sent with the request, in the message body. There are usually extra headers to describe this message body, like Content-Type: and Content-Length:.
The request URI is not a resource to retrieve; it's usually a program to handle the data you're sending.
The HTTP response is normally program output, not a static file.

The most common use of POST, by far, is to submit HTML form data to CGI scripts. In this case, the Content-Type: header is usually application/x-www-form-urlencoded, and the Content-Length: header gives the length of the URL-encoded form data (here's a note on URL-encoding). The CGI script receives the message body through STDIN, and decodes it. Here's a typical form submission, using POST:

POST /path/script.cgi HTTP/1.0
From: frog@jmarshall.com
User-Agent: HTTPTool/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 32

home=Cosby&favorite+flavor=flies

You can use a POST request to send whatever data you want, not just form submissions. Just make sure the sender and the receiving program agree on the format.


Gruß
SaRu_

Darkrel

Treue Seele

Beiträge: 143

Wohnort: Zürich

Beruf: Student ETH Zürich

  • Private Nachricht senden

56

10.06.2011, 12:41

/vote Developer_X ? :P
:cursing:

57

10.06.2011, 14:04

:thumbsup:

JRJ

Treue Seele

Beiträge: 113

Wohnort: Tirol

Beruf: Schüler

  • Private Nachricht senden

58

10.06.2011, 16:22

:D

Werbeanzeige