How to make a web request to a public PHP url with IFTTT










-1















I need to send some data to a public php url in a online server, im using IFTTT platform were when i post a tweet i need to send the information of the tweet (Username, Hashtag, Content...) to the php url for save it in a DataBase.



i tried to do this, the php page will save the username and the IP were the request was sended, but it doesn't work.




MakerWebhooks.makeWebRequest.setUrl("http://www.mypage.com/tweet.php");
MakerWebhooks.makeWebRequest.setMethod("GET");
MakerWebhooks.makeWebRequest.setContentType("application/json");
MakerWebhooks.makeWebRequest.setBody("?user='username'");




and this is the code of the php file, it just take the user sended by the url and save it in a text file with the IP address, its just for test the webhooks, but it doesnt work



<?php
$usuario = null;
$nombre_archivo = "log.txt";
date_default_timezone_set("America/Mexico_City");

if(isset($_GET['usuario']))
$usuario = $_GET['usuario'];


if($archivo = fopen($nombre_archivo, "a"))
fwrite($archivo, $usuario." con IP ".getRealIP()." n");
fclose($archivo);


function getRealIP()
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];

?>


Sorry about my english :P










share|improve this question



















  • 1





    You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

    – Obsidian Age
    Nov 6 '18 at 23:04











  • Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

    – Batres35
    Nov 7 '18 at 4:51















-1















I need to send some data to a public php url in a online server, im using IFTTT platform were when i post a tweet i need to send the information of the tweet (Username, Hashtag, Content...) to the php url for save it in a DataBase.



i tried to do this, the php page will save the username and the IP were the request was sended, but it doesn't work.




MakerWebhooks.makeWebRequest.setUrl("http://www.mypage.com/tweet.php");
MakerWebhooks.makeWebRequest.setMethod("GET");
MakerWebhooks.makeWebRequest.setContentType("application/json");
MakerWebhooks.makeWebRequest.setBody("?user='username'");




and this is the code of the php file, it just take the user sended by the url and save it in a text file with the IP address, its just for test the webhooks, but it doesnt work



<?php
$usuario = null;
$nombre_archivo = "log.txt";
date_default_timezone_set("America/Mexico_City");

if(isset($_GET['usuario']))
$usuario = $_GET['usuario'];


if($archivo = fopen($nombre_archivo, "a"))
fwrite($archivo, $usuario." con IP ".getRealIP()." n");
fclose($archivo);


function getRealIP()
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];

?>


Sorry about my english :P










share|improve this question



















  • 1





    You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

    – Obsidian Age
    Nov 6 '18 at 23:04











  • Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

    – Batres35
    Nov 7 '18 at 4:51













-1












-1








-1








I need to send some data to a public php url in a online server, im using IFTTT platform were when i post a tweet i need to send the information of the tweet (Username, Hashtag, Content...) to the php url for save it in a DataBase.



i tried to do this, the php page will save the username and the IP were the request was sended, but it doesn't work.




MakerWebhooks.makeWebRequest.setUrl("http://www.mypage.com/tweet.php");
MakerWebhooks.makeWebRequest.setMethod("GET");
MakerWebhooks.makeWebRequest.setContentType("application/json");
MakerWebhooks.makeWebRequest.setBody("?user='username'");




and this is the code of the php file, it just take the user sended by the url and save it in a text file with the IP address, its just for test the webhooks, but it doesnt work



<?php
$usuario = null;
$nombre_archivo = "log.txt";
date_default_timezone_set("America/Mexico_City");

if(isset($_GET['usuario']))
$usuario = $_GET['usuario'];


if($archivo = fopen($nombre_archivo, "a"))
fwrite($archivo, $usuario." con IP ".getRealIP()." n");
fclose($archivo);


function getRealIP()
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];

?>


Sorry about my english :P










share|improve this question
















I need to send some data to a public php url in a online server, im using IFTTT platform were when i post a tweet i need to send the information of the tweet (Username, Hashtag, Content...) to the php url for save it in a DataBase.



i tried to do this, the php page will save the username and the IP were the request was sended, but it doesn't work.




MakerWebhooks.makeWebRequest.setUrl("http://www.mypage.com/tweet.php");
MakerWebhooks.makeWebRequest.setMethod("GET");
MakerWebhooks.makeWebRequest.setContentType("application/json");
MakerWebhooks.makeWebRequest.setBody("?user='username'");




and this is the code of the php file, it just take the user sended by the url and save it in a text file with the IP address, its just for test the webhooks, but it doesnt work



<?php
$usuario = null;
$nombre_archivo = "log.txt";
date_default_timezone_set("America/Mexico_City");

if(isset($_GET['usuario']))
$usuario = $_GET['usuario'];


if($archivo = fopen($nombre_archivo, "a"))
fwrite($archivo, $usuario." con IP ".getRealIP()." n");
fclose($archivo);


function getRealIP()
if (!empty($_SERVER['HTTP_CLIENT_IP']))
return $_SERVER['HTTP_CLIENT_IP'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
return $_SERVER['REMOTE_ADDR'];

?>


Sorry about my english :P







php webhooks ifttt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 '18 at 5:14









Mojo Allmighty

645316




645316










asked Nov 6 '18 at 22:56









Batres35Batres35

11




11







  • 1





    You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

    – Obsidian Age
    Nov 6 '18 at 23:04











  • Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

    – Batres35
    Nov 7 '18 at 4:51












  • 1





    You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

    – Obsidian Age
    Nov 6 '18 at 23:04











  • Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

    – Batres35
    Nov 7 '18 at 4:51







1




1





You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

– Obsidian Age
Nov 6 '18 at 23:04





You're currently sending a GET request to tweet.php?user=username. Do you have PHP code that does something with a $_GET['user'] variable? If so, please share that, thus forming a minimal, complete, and verifiable example, along with clearly stating what your desired result is. For further information, please refer to the help article regarding how to ask good questions, and take the tour of the site :)

– Obsidian Age
Nov 6 '18 at 23:04













Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

– Batres35
Nov 7 '18 at 4:51





Yes, i recieve the variable with a GET, i put the code of the file php in the post, thanks.

– Batres35
Nov 7 '18 at 4:51












1 Answer
1






active

oldest

votes


















0














$usuario = $_GET['usuario']; usuario should match the URL parameter 'user'.



Therefore try



$usuario = $_GET['user'];






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53181351%2fhow-to-make-a-web-request-to-a-public-php-url-with-ifttt%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    $usuario = $_GET['usuario']; usuario should match the URL parameter 'user'.



    Therefore try



    $usuario = $_GET['user'];






    share|improve this answer



























      0














      $usuario = $_GET['usuario']; usuario should match the URL parameter 'user'.



      Therefore try



      $usuario = $_GET['user'];






      share|improve this answer

























        0












        0








        0







        $usuario = $_GET['usuario']; usuario should match the URL parameter 'user'.



        Therefore try



        $usuario = $_GET['user'];






        share|improve this answer













        $usuario = $_GET['usuario']; usuario should match the URL parameter 'user'.



        Therefore try



        $usuario = $_GET['user'];







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 '18 at 16:11









        BicycleBicycle

        279




        279



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53181351%2fhow-to-make-a-web-request-to-a-public-php-url-with-ifttt%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo