Can't read the data extracted from a pdf form with php script

Username epiz_28335387

Hello,

I am new here and I am using a php script to extract data from a pdf form (the submission into html form is configured using adobe acrobat pro).
My problem is that my php script is not extracting the data. I am sure my php script is right because it was working on another website. So I am wondering if it has here the permission to extract the data ? Of course I ticked all the box marked read/write/execute. Or maybe my account is not fully functional, it is a free account or something else I am not suspecting. My php script is running cause I got the writing posted except the variables of the data that should be extracted.

Thank you for your help!

Here is my php script :

<?php
$p = $_POST['prenom'];
$n = $_POST['nom'];
$score = $_POST['PointsField_QCM2'];
$IU = $_POST['IdInfo_UserName'];
$IP = $_POST['IdInfo_Password'];
$pscore=preg_replace('/[^0-9.,]/','',$score);
$pts=substr($pscore,0,-3);
$total=substr($pscore,-3);

$servername = "xxxxx";
$username = "xxxxx";
$password = "xxxxxx";
$dbname="xxxxxxxxxxxx";




$mysqli = mysqli_connect('xxxxxxx','xxxxxxxxxx','xxxxxxxxxxxxxx','xxxxxxxxxx');

$query = $mysqli->prepare('insert into xxxxx (date,nom,prenom,score,user,nda) values(?,?,?,?,?,?)');
     
$query->bind_param('ssssss',$date,$n,$p,$pts,$IU,$IP);
$query->execute();

print("<br />");
print("<br />");
print("<br />");
print("<br />");


print("<center> <p style='font-size:25px;'> Bonjour $p $n!! </p></center>");

print("<center> <p style='font-size:25px;'> Vous avez obtenu une note de $pts sur $total.</p> </center>");



print("<center> <p style='font-size:25px;'> Merci d'avoir effectué ce quiz, Bonne journée! </p> </center>");



//print("<center> <p style='font-size:25px;'> $date </p> </center>");


?>

Hello, can you please provide your website URL and account username? (epiz_XXXXXXX)
Thanks!

Hello,

My account user name is epiz_28335387, my url is interactive-online-math.rf.gd and the url on the pdf form submission button is http://interactive-online-math.rf.gd/exportdata-dev1-9g5-h21.php.

NOTE: I do not know PHP, if I say something dumb or wrong here, please let me know, but I am responding based of what I do know, and what I see on your site. Thanks.

I don’t see any other files on your website besides the form one. I do not see a form on your website, or a file that the script is supposed to be extracting from. Looking at your PHP file, it looks like it supposed to do something with an SQL database and a HTML form. I am assuming that a series of X’s are not going to work for the “username”, “password”, “dbname” and “mysql” fields. I also do not see a HTML form on your site.

I am going to assume your script needs these things to work, and that may be casing the error. If you did set it up correctly, you will have to wait for someone else to help you out.
Thanks!

Hello Greenreader9,
My form is a pdf form it is a math assignment and my student can send me their result and name to my database and have their score display with the php script.
Actually I can’t upload it here cause I am a new user but I just put it on my website, you can try it with user name mayfay and password 2223.
The xxxxx are to protect my information but I can provide some of them of course.
Thanks!

You have to open the pdf form with acrobat reader dc not with the pdf reader of your browser (it is usually that by default) cause it has javascript code that need to be interpreted to correct the answers.

No one here is using a php script to read a pdf form and to send data to mysql ?

I don’t see a way to upload a pdf on your website. How it is supposed to work? Can you send a video?

What I see:


Thanks!

Hello Greenreader9, I sent a pdf form to my student they fill it with the answers ( I am using acrotex so they can give mathematical answers) and at the end they have a submission button to send the form in html to my website on infintyfree where I have a php script that can read the data send them to mysql and display ithe result for the students. I put the pdf form in my space but maybe it is not visible for you and I can’t upload it here cause I am a new user.

One thing I’m not seeing in your code is error handling. Most database connectivity code has some kind of error catching, like making sure that $query->execute() actually returns true and not false indicating the query failed.

Hello Admin, thank you for your answer. I have error handling I just cut it to give the essential information on my script, if you check the link I provided http://interactive-online-math.rf.gd/exportdata-dev1-9g5-h21.php when displaying my script it indicates connected successfully.
My problem is that the script didn’t extract data from my pdf form and I don’t understand why ? I don’t know also if the link I add to my submission button is right,

You say this is a PDF form? So a form in a PDF document? Which has some kind of scripting to send the data out?

I just looked it up and I really didn’t know that this was possible. I’ll be a lot more careful with PDFs now.

In any case, I don’t think this will work here. After all, we provide website hosting, not some kind of data hosting platform. And this security system will prevent you from doing so:

3 Likes

Thank you for your answer, I fully understand the security concerns but my intention is not to share files since I can send my pdf form by email or place it in any application I use with my students but I want to collect the score and the name of my students when they take at home the test on the pdf form so I need that data to be sent to a place where I can extract it with a php script and collect them into a database.

That wasn’t really the point I was trying to make.

What I was trying to say is that our servers have a security system in place which ensure that websites hosted here can only be accessed through regular web browser. Sending data programmatically from other places (including your PDF scripts) is not possible.

After all, we provide website hosting, not database hosting.

The article I linked to explains more about this.

1 Like

Yes I understand these legitimate security concerns, my problem is that I can’t use html forms inside the website since my pdf form are using acrotex and are more complicated than html forms.
It seems I am hitting a wall cause I don’t see any other way to have the data sent from a php form to a php script that will extract it to the database. I am thinking of a local server on my laptop but it will not be accessible anytime by internet ? If anyone has a solution I am more than interested!

Did you read @Admin’s response?

Yes I don’t understand your point ? Did you read mine ?
I am asking if there is an alternative solution out of here

If you mean on InfintyFree, I don’t think so

I mean on xampp for example or anywhere else that will be possible if someone has an idea I can’t be the only one to be stuck trying to collect data from a pdf form to mysql.

Use a different hosting provider maybe? Our premium partner iFastNet doesn’t have a system like this on their paid accounts.

We can’t provide the service you’re looking for, I’m sorry to say.

3 Likes