Mercurial > hg > ywww
comparison xml/amazonBookSearch.php @ 42:3f400072bf14
merge, involved ediff3 wrt getAmazonInfo.php
| author | Charlie Root |
|---|---|
| date | Sat, 05 Jan 2019 06:21:12 -0500 |
| parents | b1bbf44c701b |
| children | dbc006408d2b |
comparison
equal
deleted
inserted
replaced
| 41:0578c6e438d3 | 42:3f400072bf14 |
|---|---|
| 91 $timeout = 5; | 91 $timeout = 5; |
| 92 curl_setopt ($crl, CURLOPT_URL,$url); | 92 curl_setopt ($crl, CURLOPT_URL,$url); |
| 93 curl_setopt ($crl, CURLOPT_ENCODING , "gzip"); | 93 curl_setopt ($crl, CURLOPT_ENCODING , "gzip"); |
| 94 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); | 94 curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1); |
| 95 curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); | 95 curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout); |
| 96 $gotit=0; | |
| 97 $semaphore = new SyncSemaphore("Amazon"); | |
| 98 $gotit = $semaphore->lock(1000); | |
| 99 if (!$gotit) { | |
| 100 file_put_contents('/var/ywww/debug/phpDebug', | |
| 101 "Got it: ".(int)$gotit." 3\n",FILE_APPEND); | |
| 102 $gotit=$semaphore->lock(1000); | |
| 103 file_put_contents('/var/ywww/debug/phpDebug', | |
| 104 "Got it: ".(int)$gotit." 3a\n",FILE_APPEND); | |
| 105 } | |
| 96 $ret = curl_exec($crl); | 106 $ret = curl_exec($crl); |
| 97 curl_close($crl); | 107 curl_close($crl); |
| 108 usleep(500000); | |
| 109 if ($gotit) { | |
| 110 $semaphore->unlock(); | |
| 111 } | |
| 112 else { | |
| 113 file_put_contents('/var/ywww/debug/phpDebug',"W/o lock 3b\n",FILE_APPEND); | |
| 114 } | |
| 98 echo $ret; | 115 echo $ret; |
