Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The only way you will get the same voucher code is if the remote server generates the same code twice. You are correct in saying <code>php do not run in parallel</code> but concurrency has nothing to do with your specific case, there is no way the two HTTP response get mixed up with each other because they are sent back to you in different TCP streams. The underlying TCP/IP stack of the OS will prevent collisions.</p> <p>Regardless of this, you should be able to check for collisions after you have received the data. For example, if you are inserting it into an SQL database, you can create a unique index on the field that holds the code, and the database will prevent you from inserting duplicated rows.</p> <p>As a side note, you say you <code>can explode each line</code> which is true, but you may wish to have a look at <a href="http://www.php.net/manual/en/function.fgetcsv.php" rel="nofollow"><code>fgetcsv()</code></a> and <a href="http://www.php.net/manual/en/function.str-getcsv.php" rel="nofollow"><code>str_getcsv()</code></a>, which will parse the line for you and take into account escape sequences and all sorts of edge-cases that you code will not account for. If you want to perform multiple cURL requests at once, you may also want to have a look at <a href="http://www.php.net/manual/en/function.curl-multi-exec.php" rel="nofollow"><code>curl_multi_exec()</code></a>, which will allow you to execute several requests at once and speed up the execution of your script.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload