Bekommt der echt 2 upvotes?



  • Wenn ich sowas lesen muss, werd ich immer ganz traurig 😞

    up 2 down
    3 years ago

    irish [-@-] ytdj [-dot-] ca ¶ schrieb:

    When using the http_build_query function to create a URL query from an array for use in something like curl_setopt($ch, CURLOPT_POSTFIELDS, $post_url), be careful about the url encoding.

    Instead you can make your own simple function if you simply want to pass along the data:

    <?php
    $post_url = '';
    foreach ($_POST AS $key=>$value)
        $post_url .= $key.'='.$value.'&';
    $post_url = rtrim($post_url, '&');
    ?>
    

    You can then use this to pass along POST data in CURL.

    <?php
        $ch = curl_init($some_url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_url);
        curl_exec($ch);
    ?>
    

    Note that at the final page that processes the POST data, you should be properly filtering/escaping it.

    Hm... wer findet den Fehler? 🙄



  • zebra schrieb:

    Hm... wer findet den Fehler? 🙄

    Du schreibst im falschen Subforum.



  • Michael E. schrieb:

    zebra schrieb:

    Hm... wer findet den Fehler? 🙄

    Du schreibst im falschen Subforum.

    Da deckt man Weltverändernde Fehler auf, und dann ist man im falschen Subforum 😃



  • weltverändernde Fehler... 🤡


Anmelden zum Antworten