Jump to content

gw1500se

Members
  • Posts

    1,033
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by gw1500se

  1. There you go. Just JSON decode it in c++.
  2. 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.
  3. echo "<pre>"; var_dump(getallheaders()); echo "</pre>";
  4. 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.
  5. That is a JSON string. Cereal will do what you want in c++.
  6. 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.
  7. How about making your script readable? Use the code icon (<>) and select PHP.
  8. "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.
  9. 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?
  10. 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.
  11. You're kidding, right? Try 'echo'.
  12. 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.
  13. So what are you asking of us?
  14. 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.
  15. 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.
  16. 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>";
  17. 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) {
  18. 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?
  19. 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.
  20. Start with a flow chart and develop a database schema.
  21. https://www.php.net/manual/en/mysqli.multi-query.php
  22. 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.
  23. Do you not know how to send and email or do you not know how to tell when the paypal API returns successful payment?
  24. When you do echo $query and post that.
  25. You don't say what the error is but that is a different problem. Start an new thread on the MySQL forum.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.