/    Sign up×
Community /Pin to ProfileBookmark

How to grab the content (values) from this program.

“`
function idx_register_user(){
if(!empty($_POST[‘firstname’]) && !empty($_POST[‘lastname’]) && !empty($_POST[’email’]) && !empty($_POST[‘phone’]) && !empty($_POST[‘pw’])){
$userdata = [
‘user_pass’ => get_option(‘idx_vow_mode’) === ‘onx’ ? ‘8675309’ : $_POST[‘pw’],
‘user_login’ => $_POST[’email’],
‘user_nicename’ => $_POST[‘firstname’].’-‘.$_POST[‘lastname’],
‘user_email’ => $_POST[’email’],
‘display_name’ => $_POST[‘firstname’],
‘first_name’ => $_POST[‘firstname’],
‘last_name’ => $_POST[‘lastname’]
];

“`

Does anyone know how to extract the values out of a small program like this…. I would like the program to continue running once the data is extracted. I have full access to the server so not going to have a problem with cross browser and such… I would be willing to pay a decent amount if someone has an idea how to grab this data when it passes thru this area. Thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 25.2021 — Pretty vague requirement, but depending on how you want to do things, you could simply write the data to a file, maybe using PHP's error_log() function, or you could write it to a database table. E.g.:
[code=php]
// right after $userdata is populated:
error_log(json_encode($userdata)."n", 3, '/path/to/whatever/file/you/want.json');
[/code]
Copy linkTweet thisAlerts:
@tommytxauthorMay 30.2021 — If you can shed light on how to extract this data from this file you will forever be in my debt... Thank you.

at this link is a txt file showing the entire file called UserSavephp.txt (Normally a php file not text...)

I would like for the code to continue running after I extract the data....if possible.

I just want a snippet of code that can extract the data like in a $string like

$email = email.. using magic to convert it...

'user_email' => $_POST['email'],

I tried like $email = $_
POST['email'] but that did not convert it to a string.


'display_name' => $_POST['firstname'],
'first_name' => $_POST['firstname'],
'last_name' => $_POST['lastname']


http://www.crontest.xyz/testing/UserSavesphp.txt

Thank you NogDog... looks like you are right on top of the answer but i am not able to pull it off yet.. a little more info may make it easier for you....
  • 1. This is a php program... but i can see all sorts of script code all over it.. so the conversions that I know do not work.
  • 2. Do I need to play with adding script here for the json to work? in this specific environment...Its in a wp site so I assume any php may be tweaked to work in wp if that is needed....

  • 3. Below I show some of the places I tried.. and failed.. Believe me I tried some crazy stuff so don't laugh.. I am just learning some of this stuff... but its urgent that i get this to work.. so I cannot thank you enough for your assistance.

    if you have other questions i would be happy to answer or even post the entire file if it will help.



  • <br/>
    function idx_register_user(){<br/>
    if(!empty($<EM>_POST['firstname']) &amp;&amp; !empty($_</EM>POST['lastname']) &amp;&amp; !empty($<EM>_POST['email']) &amp;&amp; !empty($_</EM>POST['phone']) &amp;&amp; !empty($_POST['pw'])){
    <br/>
    // Tried here...error_log(json_encode($userdata)."n", 3, '/tomdata0.json';
    <br/>
    <i> </i><CODE> $userdata = [
    <i> </i> 'user_pass' =&gt; get_option('idx_vow_mode') === 'onx' ? '8675309' : $_POST['pw'],
    <i> </i> 'user_login' =&gt; $_POST['email'],
    <i> </i> 'user_nicename' =&gt; $_POST['firstname'].'-'.$_POST['lastname'],
    <i> </i> 'user_email' =&gt; $_POST['email'],
    <i> </i> 'display_name' =&gt; $_POST['firstname'],
    <i> </i> 'first_name' =&gt; $_POST['firstname'],
    <i> </i> 'last_name' =&gt; $_POST['lastname']
    <i> </i> ];</CODE>

    // Tried here error_log(json_encode($userdata)."n", 3, '/tomdata0.json';

    // Tried below.. none of that is the normal code below.<br/>
    // This is my crazy attempt to hide it from the rest of the site so maybe to keep the program running wo it seeing the data being operated on..<br/>
    ob_start();<br/>
    &lt;script&gt;<br/>
    $data = json_encode($userdata);<br/>
    &lt;/script&gt;<br/>
    $data = ob_get_clean();

    Copy linkTweet thisAlerts:
    @NogDogMay 30.2021 — > @tommytx#1632296 ob_start();
    <i>&gt; </i>&lt;script&gt;
    <i>&gt; </i>$data = json_encode($userdata);
    <i>&gt; </i>&lt;/script&gt;
    <i>&gt; </i>$data = ob_get_clean();


    That makes no sense, in that the PHP code will run on the server before the browser ever sees those &lt;script&gt; tags -- which probably are just throwing a PHP syntax error right now?

    > error_log(json_encode($userdata)."n", 3, '/tomdata0.json';

    Note that if that runs, it will (try to) write to a file named tomdata0.json located in the root directory of the web server (/). I'm guessing that's probably not where you want to write it? (Also, wherever you do want to write it, the web server user will need write access, as that is the user that will actually be executing the PHP page.)
    Copy linkTweet thisAlerts:
    @tommytxauthorMay 30.2021 — Thanks NoDog you are my new hero.

    you did not give me the answer but you taught me how to fish....

    I followed one very subtle hint....

    error_log(json_encode($userdata)."n", 3, '/tomdata0.json';

    You said that sucker gonna land in the root.. which i doubt you want... I was about to ask which root the root of the site or the root of the server..... then gave it a full path and it worked perfect.... Also i need to capture other data also and this is going to be very helpful. I think its worth looking up lots of your other posts I believe i can learn a lot from POSTS THAT HAVE HELPED OTHERS that you have already written..

    I wish you were a member of the Mautic Forum... A FREE CRM system.. open source.... We need smart folks like your self... and what i am working on as we speak is Mastering the Mautic API is very important to me and i have offered up a hundred dollar bounty for anyone solving my problem there... and that is to have a basic Mautic API that I can make work for me. I have asked this same question about what you easily answered for me in seconds and so far on a dozen forums no one else has answered it.

    IF you wanta jump over tohttps://forum.mautic.org/t/is-anyone-willing-to-share-a-template-to-allow-me-to-communicate-with-the-mautic-api-for-100/19473 and take a look I would appreciate it... Plus if anyone deserves a hundred dollar bill for just a a few min work... it would be you.....

    I just want to get the very simple Mautic API working so that i can work with the contacts in the data base....

    THANK YOU SO MUCH FOR WHAT YOU HAVE ALREADY DONE!
    ×

    Success!

    Help @tommytx spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.25,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...