-
Posts
1,033 -
Joined
-
Last visited
-
Days Won
17
Everything posted by gw1500se
-
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
There you go. Just JSON decode it in c++. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
Not quite. That will create a JSON array with the name and size as separate entries. You want each name to be associated with its specific size so create an array of arrays. $send=[]; foreach ($files as $key => $val) { $send+=array('Name'=>basename($val),'Size'=>filesize($val)); } Then on the c++ side you will have an array of n entries where each entry contains an array with the key 'name' and 'size' with their respective values. -
echo "<pre>"; var_dump(getallheaders()); echo "</pre>";
-
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
Use curl to activate a PHP script that deletes the file. Here is where you will need some kind of security. Perhaps send the file name in an encrypted string that only the server can decrypt. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
That is a JSON string. Cereal will do what you want in c++. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
You can't. You need to take the output from the PHP script and process it into an array in c++. What format did you choose to return in the PHP script? If JSON then you need to use c++ json decode to convert it to an array. -
CURL PHP Crawler Returns Access Denied Error
gw1500se replied to Geoffism00's topic in PHP Coding Help
How about making your script readable? Use the code icon (<>) and select PHP. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
"http://localhost//Download//info.txt" needs to be the PHP script that returns any files ready for download. You did not post the code where you read the result from the curl_easy_perform. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
Your questions seem to be going in circles. Lets back up and and tell us how you are using curl in your c++ program. I assume you are using the c++ curl library, right? -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
Echo means that information, as a string, will be collected by the issuing curl command. That is the whole point of curl get. The format you use (JSON, XML, comma delimited) is up to you when you echo the names. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
You're kidding, right? Try 'echo'. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
When your client contacts the server, have the PHP script return the names of any files that are ready to download. Then have the client request the download of those files. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
So what are you asking of us? -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
This is a help forum not a free coding forum, if that is what you are asking. You need to do the work and if you have problems, show what you did, what you expect and what is wrong. A summary of what you want is to write a PHP script that is launched by the client via curl. That script would then check the directory for a file(s) and if present start the download. Once complete the client would confirm the successful download and have the PHP script delete the file. -
upload files from php server to c++ client using curl
gw1500se replied to jazz15's topic in PHP Coding Help
You will need to turn your thinking around. You need the client to periodically query the server and have the server tell the client if there is a file to download. Then the client can download the file from the server and when complete the server can delete the file. -
You need to learn to use these functions. Notice how unreadable your output is. If you RTFM you would see that var_dump outputs a structured format. Try again with: echo "<pre>"; var_dump($return); echo "</pre>";
-
Do a 'var_dump($return)' to see exactly how the decode structures the return array. From that you will see what your error is. As a hint, your foreach statement should look more like: foreach ($return as $key=>$val) {
-
First please use the code icon (<>) and select PHP so it formats your code to make is easier to read. Second you probably should be using PHPMailer for your email. It is much easier to use and gives you better control. Finally to debug this you need to make sure you have errors enabled but your insert does not contain the field 'id'. Where do you add that to the record?
-
I think you are asking for a singleton class: class MyFetchController { $inst=null; // private constructor so it cannot be instantiated externally private function__contruct() { // initialzation code here as needed } public function Instance() { if ($inst==null) { $inst=new MyFetchController(); } return $inst; } } Any time you want that class call 'Instance' and you will always get the same instance.
-
BUILDING A TRANSCRIPT SYSTEM USING PHP/MYSQL
gw1500se replied to JophusEdumadze's topic in PHP Coding Help
Start with a flow chart and develop a database schema. -
https://www.php.net/manual/en/mysqli.multi-query.php
-
Try this: $queryString="SELECT cat_id, subcat_id, subcategory_title, subcategory_desc FROM categories, subcategories WHERE ($parent_id = categories.cat_id) AND ($parent_id = subcategories.parent_id"; echo $queryString; $select = mysqli_query($con,$queryString); Look at the echo'ed string to find the syntax error.
-
When you do echo $query and post that.
-
You don't say what the error is but that is a different problem. Start an new thread on the MySQL forum.