NotionCommotion
Members-
Posts
2,446 -
Joined
-
Last visited
-
Days Won
10
Everything posted by NotionCommotion
-
I have two curl requests. One works fine and the other causes an error. -sh-4.1$ curl -X POST --header 'Accept: application/json' --header 'api_key: main_key' -d '{ "property_one": "string", "property_two": "string" }' 'http://test.example.com/1.0/test' {"post":{"{_\"property_one\":_\"string\",_\"property_two\":_\"string\"_}":""}} -sh-4.1$ curl -X POST --header 'Content-Type: application/json' -d '{ "property_one": "string", "property_two": "string" }' 'http://test.example.com/1.0/test' <br /> <b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br /> {"post":[]}<br /> Per http://php.net/manual/en/migration56.deprecated.php#migration56.deprecated.raw-post-data: How and where am I automatically populating $HTTP_RAW_POST_DATA? EDIT. I just changed my php.ini file and set always_populate_raw_post_data=-1, and now don't get the error, but PHP doesn't receive the POST data. I am obviously doing something wrong by setting the content type header and passing post data. Please advise.
-
No need to delete as per http://php.net/manual/en/features.file-upload.post-method.php, " The file will be deleted from the temporary directory at the end of the request if it has not been moved away or renamed." The only time PUT might make sense is replacing an existing file with a new one, and it is probably not worth the trouble.
-
It sounds kind of like when two people grade each other. Buyer A and Seller B perform an interaction. After the interaction, the broker asks both of them to grade the other, but neither can see what the other said into they have both graded one another. Is this what you are attempting to accomplish?
-
Had one line incorrect. Works perfect now. $data2[$name] = new CURLFile($file['tmp_name'],$file['type'],$file['name']); Should I bother deleting old tmp_name files? Also, should http method post only be used? Thanks!
-
I am obviously doing something wrong because this works. <?php // Create a cURL handle $ch = curl_init('http://example.com/fileuploader.php'); // Create a CURLFile object $cfile = new CURLFile('arrow.gif','image/gif','test_name'); // Assign POST data $data = array('test_file' => $cfile); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // Execute the handle curl_exec($ch);
-
Nice. I don't even need to modify my method. I am getting an empty array reply, so I evidently am not doing this correctly. Know where I am going astray? Thanks <?php function CallAPI($method, $url, $data, array $headers=[], $options=[], $debug=false) { $options=$options+[ //Don't use array_merge since it reorders! CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "unknown",// who am i CURLOPT_AUTOREFERER => true, // set referrer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks. FIX!!!!!!!!! ]; //Optional authentication if (isset($options[CURLOPT_USERPWD])) {$options[CURLOPT_HTTPAUTH]=CURLAUTH_BASIC;} switch (strtolower($method)) { case "get": if ($data) {$url = sprintf("%s?%s", $url, http_build_query($data));} break; case "post": $options[CURLOPT_POST]=1; if ($data) {$options[CURLOPT_POSTFIELDS]=$data;} break; case "put": //$options[CURLOPT_PUT]=1; $options[CURLOPT_CUSTOMREQUEST]="PUT"; if ($data) {$options[CURLOPT_POSTFIELDS]=http_build_query($data);} break; case "delete": //$options[CURLOPT_DELETE]=1; $options[CURLOPT_CUSTOMREQUEST]="DELETE"; if ($data) {$options[CURLOPT_POSTFIELDS]=http_build_query($data);} break; default:trigger_error("Invalid HTTP method.", E_USER_ERROR); } $options[CURLOPT_URL]=$url; $ch = curl_init(); curl_setopt_array( $ch, $options ); if($headers) { curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); } $content = curl_exec( $ch ); if(!$debug){$results=$content;} else { $results = curl_getinfo( $ch ); $results['errno'] = curl_errno( $ch ); $results['errmsg'] = curl_error( $ch ); $results['content'] = $content; } curl_close( $ch ); return $results; } if($_SERVER['REQUEST_METHOD']=='POST') { $data=[]; foreach($_FILES as $name=>$file) { $data[] = [$name => new CURLFile($file['tmp_name'],$file['type'],$file['name'])]; } $rs=CallAPI('post', 'http://example.com/fileuploader.php', $data,['X-SECRET-KEY: 1234']); foreach($_FILES as $file) { unlink($file['tmp_name']); } echo('<pre>'.print_r($rs,1).'</pre>'); } ?> <! DOCTYPE html> <html> <body> <form method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="Upload"> </form> </body> fileuploader.php <?php header('Content-Type: application/json'); echo(json_encode($_FILES));
-
A client uploads a file to a server, and the server receives the following. The server uses a session to verify that the user is logged on, and if so, gets the users secret key, puts it in a header using CURLOPT_HTTPHEADER, and sends the file to another server using cURL. I've never sent a file using cURL. Anything special? Guess I can leave the file in its temp location and not use move_uploaded_file(), right? Should I delete it after it is sent? My current cURL method is below. Any recommendations on how it can accommodate files? Accept application/json, text/javascript, */*; q=0.01 Accept-Encoding gzip, deflate Accept-Language en-US,en;q=0.5 Content-Length 31299 Content-Type multipart/form-data; boundary=---------------------------159893106321761 Host dd.example.com Referer http://dd.example.com/resources User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0 X-Requested-With XMLHttpRequest -----------------------------159893106321761 Content-Disposition: form-data; name="resources[]"; filename="aboutus.png" Content-Type: image/png PNG IHDR8 bla bla bla Ö®ÿùæÔ^_×w8IEND®B` -----------------------------159893106321761-- private function CallAPI($method, $url, $data, array $headers=[], $options=[], $debug=false) { $options=$options+[ //Don't use array_merge since it reorders! CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "unknown",// who am i CURLOPT_AUTOREFERER => true, // set referrer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_SSL_VERIFYPEER => false // Disabled SSL Cert checks. FIX!!!!!!!!! ]; //Optional authentication if (isset($options[CURLOPT_USERPWD])) {$options[CURLOPT_HTTPAUTH]=CURLAUTH_BASIC;} switch (strtolower($method)) { case "get": if ($data) {$url = sprintf("%s?%s", $url, http_build_query($data));} break; case "post": $options[CURLOPT_POST]=1; if ($data) {$options[CURLOPT_POSTFIELDS]=$data;} break; case "put": //$options[CURLOPT_PUT]=1; $options[CURLOPT_CUSTOMREQUEST]="PUT"; if ($data) {$options[CURLOPT_POSTFIELDS]=http_build_query($data);} break; case "delete": //$options[CURLOPT_DELETE]=1; $options[CURLOPT_CUSTOMREQUEST]="DELETE"; if ($data) {$options[CURLOPT_POSTFIELDS]=http_build_query($data);} break; default:trigger_error("Invalid HTTP method.", E_USER_ERROR); } //$this->logger->addInfo("$method $url ".json_encode($data)); $options[CURLOPT_URL]=$url; $ch = curl_init(); curl_setopt_array( $ch, $options ); if($headers) { curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); } $content = curl_exec( $ch ); if(!$debug){$results=$content;} else { $results = curl_getinfo( $ch ); $results['errno'] = curl_errno( $ch ); $results['errmsg'] = curl_error( $ch ); $results['content'] = $content; } curl_close( $ch ); return $results; }
-
Using both PHP5 and PHP7
NotionCommotion replied to NotionCommotion's topic in PHP Installation and Configuration
I've never configured Apache to utilize more than one version, but based on your response, I take it that it is possible (and not that difficult). -
Am I able to install PHP7 and keep PHP5 on my server without creating a virtual server? Thank you
-
Thanks Kicken, Yes, I do recall your earlier response to one of my other threads! And I am sure your response addresses the particular pimple/slim classes. I am still confused, however, how I can assign a function to two different array elements, and one exists and the other does not. I expect it has to do with those damn magic methods.
-
Warning where methods are not compatible
NotionCommotion replied to NotionCommotion's topic in PHP Coding Help
Thanks Jacques, Nice explanation. -
How can I prevent getting a warning? I can make Editor::display($page_id=NULL), but I would rather not as not passing a value should represent an error. Strict Standards: Declaration of MyApp\Editor::display() should be compatible with MyApp\Base::display($page_id = NULL) in /var/www/application/classes/Editor.php on line 0 <?php namespace MyApp; class Base { public function display($page_id=null){ return ['menu_main'=>$this->getMenu()]; } } class Editor extends Base { public function display($page_id){ } }
-
Why am I not able to execute $container2['hello']($container2)? $container1['hello'] = function ($c) { return 'hello 1 '.print_r($c,1); }; var_dump($container1['hello']($container1)); $app = new \Slim\App(); $container2 = $app->getContainer(); $container2['hello'] = function($c) { return 'hello 2 '.print_r($c,1); }; var_dump($container2['hello']($container2)); string(178) "hello 1 Array ( [hello] => Closure Object ( [parameter] => Array ( [$c] => <required> ) ) ) " <br /> <b>Fatal error</b>: Call to undefined function hello 2 Slim\Container Object ( [defaultSettings:Slim\Container:private] => Array ( [httpVersion] => 1.1 [responseChunkSize] => 4096 [outputBuffering] => append [determineRouteBeforeAppMiddleware] => [displayErrorDetails] => [addContentLengthHeader] => 1 [routerCacheFile] => ) [values:Pimple\Container:private] => Array ( [settings] => Closure Object ( [static] => Array ( [userSettings] => Array ( ) [defaultSettings] => Array ( [httpVersion] => 1.1 [responseChunkSize] => 4096 [outputBuffering] => append in <b>/var/www/html/index.php</b> on line <b>33</b><br />
-
I say funny , you say horribly misnamed. We are saying the same thing. Dang tomatoes get all the glory.
-
Well, you can pretty much guarantee all your other script is irreverent until you fix this. How are you getting to this page? A GET or POST request? PHP is a little funny in that it populates the $_GET super even upon a POST request if the URL contains parameters.
-
Use var_dump($_GET) or echo('<pre>'.print_r($_GET,1).'</pre>'); to see what you have to work with. Then trying performing your SQL query directly in the database and look at the results. I often use the following, however, I don't know whether it will work with bind(). protected function showQuery($sql, $data) { $keys = []; $values = []; # build a regular expression for each parameter foreach ($data as $key=>$value) { if (is_string($key)) {$keys[] = '/:'.$key.'/';} else {$keys[] = '/[?]/';} //if(is_numeric($value)) {$values[] = intval($value);} if(is_numeric($value)) {$values[] = $value;} else{$values[] = '"'.$value .'"';} } $sql = preg_replace($keys, $values, $sql, 1, $count); return $sql; }
-
Ah, of course! Good to know that PHP is not in the habit of lying!
-
The forum software is not being nice to me and the editor is not appearing correctly for the first post. I think it might be because I included too much text. What confuses me is when I look at $this, I don't see the immediate property 'db" being set, but it appears to be so.
-
How can this be? $app->get('/1.0/configure', function (Request $request, Response $response, $args) { exit((isset($this->db)?'$this->db is set':'$this->db not is set').'<pre>'.print_r($this,1).'</pre>'); $mapper=new \MyApp\Configure(['logger'=>$this->db]); echo('<pre>'.print_r($mapper->display(),1).'</pre>'); return $this->view->render($response, 'configure.html',$mapper->display()); })->setName('configure'); $this->db is set Slim\Container Object ( [defaultSettings:Slim\Container:private] => Array ( [httpVersion] => 1.1 [responseChunkSize] => 4096 [outputBuffering] => append [determineRouteBeforeAppMiddleware] => [displayErrorDetails] => [addContentLengthHeader] => 1 [routerCacheFile] => ) [values:Pimple\Container:private] => Array ( [settings] => Slim\Collection Object ( [data:protected] => Array ( [httpVersion] => 1.1 [responseChunkSize] => 4096 [outputBuffering] => append [determineRouteBeforeAppMiddleware] => 1 [displayErrorDetails] => 1 [addContentLengthHeader] => [routerCacheFile] => [db] => Array ( [host] => localhost [charset] => utf8mb4 [dbname] => MyDatabase [username] => MyUsername [password] => MyPassword ) [testing] => Array ( [key] => main_key [ip] => http://testing.example.com ) ) ) [environment] => Slim\Http\Environment Object ( [data:protected] => Array ( REMOVED TO BE WITHIN PHPFREAKS SIZE LIMITS ) ) [request] => Slim\Http\Request Object ( [method:protected] => GET [originalMethod:protected] => GET [uri:protected] => Slim\Http\Uri Object ( [scheme:protected] => http [user:protected] => Michael [password:protected] => MyPassword [host:protected] => dd.example.com [port:protected] => 80 [basePath:protected] => [path:protected] => /1.0/configure [query:protected] => [fragment:protected] => ) [requestTarget:protected] => [queryParams:protected] => [cookies:protected] => Array ( [PHPSESSID] => 6m6gefl3233v5hvsok4c7bdl97 ) [serverParams:protected] => Array ( REMOVED TO BE WITHIN PHPFREAKS SIZE LIMITS ) [attributes:protected] => Slim\Collection Object ( [data:protected] => Array ( ) ) [bodyParsed:protected] => [bodyParsers:protected] => Array ( [application/json] => Closure Object ( [this] => Slim\Http\Request Object *RECURSION* [parameter] => Array ( [$input] => ) ) [application/xml] => Closure Object ( [this] => Slim\Http\Request Object *RECURSION* [parameter] => Array ( [$input] => ) ) [text/xml] => Closure Object ( [this] => Slim\Http\Request Object *RECURSION* [parameter] => Array ( [$input] => ) ) [application/x-www-form-urlencoded] => Closure Object ( [this] => Slim\Http\Request Object *RECURSION* [parameter] => Array ( [$input] => ) ) ) [uploadedFiles:protected] => Array ( ) [validMethods:protected] => Array ( [CONNECT] => 1 [DELETE] => 1 [GET] => 1 [HEAD] => 1 [OPTIONS] => 1 [PATCH] => 1 [POST] => 1 [PUT] => 1 [TRACE] => 1 ) [protocolVersion:protected] => 1.1 [headers:protected] => Slim\Http\Headers Object ( REMOVED TO BE WITHIN SIZE LIMITATIONS OF PHPFREAKS ) [body:protected] => Slim\Http\RequestBody Object ( [stream:protected] => Resource id #4 [meta:protected] => [readable:protected] => [writable:protected] => [seekable:protected] => [size:protected] => [isPipe:protected] => ) ) [response] => Slim\Http\Response Object ( [status:protected] => 200 [reasonPhrase:protected] => [protocolVersion:protected] => 1.1 [headers:protected] => Slim\Http\Headers Object ( [data:protected] => Array ( [content-type] => Array ( [value] => Array ( [0] => text/html; charset=UTF-8 ) [originalKey] => Content-Type ) ) ) [body:protected] => Slim\Http\Body Object ( [stream:protected] => Resource id #9 [meta:protected] => [readable:protected] => [writable:protected] => [seekable:protected] => [size:protected] => [isPipe:protected] => ) ) [router] => Slim\Router Object ( [routeParser:protected] => FastRoute\RouteParser\Std Object ( ) [basePath:protected] => [cacheFile:protected] => [routes:protected] => Array ( [route0] => Slim\Route Object ( [methods:protected] => Array ( [0] => GET ) [identifier:protected] => route0 [name:protected] => configure [groups:protected] => Array ( ) [finalized:Slim\Route:private] => 1 [outputBuffering:protected] => append [arguments:protected] => Array ( ) [callable:protected] => Closure Object ( [this] => Slim\Container Object *RECURSION* [parameter] => Array ( [$request] => [$response] => [$args] => ) ) [container:protected] => Slim\Container Object *RECURSION* [middleware:protected] => Array ( ) [pattern:protected] => /1.0/configure [stack:protected] => SplStack Object ( [flags:SplDoublyLinkedList:private] => 2 [dllist:SplDoublyLinkedList:private] => Array ( [0] => Slim\Route Object *RECURSION* ) ) [middlewareLock:protected] => 1 ) ) [routeCounter:protected] => 1 [routeGroups:protected] => Array ( ) [dispatcher:protected] => FastRoute\Dispatcher\GroupCountBased Object ( [staticRouteMap:protected] => Array ( [GET] => Array ( [/1.0/configure] => route0 ) ) [variableRouteData:protected] => Array ( ) ) ) [foundHandler] => Slim\Handlers\Strategies\RequestResponse Object ( ) [phpErrorHandler] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [errorHandler] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [notFoundHandler] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) ) [notAllowedHandler] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) ) [callableResolver] => Slim\CallableResolver Object ( [container:Slim\CallableResolver:private] => Slim\Container Object *RECURSION* ) [logger] => Closure Object ( [parameter] => Array ( [$c] => ) ) [db] => Closure Object ( [parameter] => Array ( [$c] => ) ) [view] => Closure Object ( [parameter] => Array ( [$c] => ) ) ) [factories:Pimple\Container:private] => SplObjectStorage Object ( [storage:SplObjectStorage:private] => Array ( ) ) [protected:Pimple\Container:private] => SplObjectStorage Object ( [storage:SplObjectStorage:private] => Array ( ) ) [frozen:Pimple\Container:private] => Array ( [settings] => 1 [router] => 1 [environment] => 1 [request] => 1 [response] => 1 [callableResolver] => 1 [foundHandler] => 1 ) [raw:Pimple\Container:private] => Array ( [settings] => Closure Object ( [static] => Array ( [userSettings] => Array ( [db] => Array ( [host] => localhost [charset] => utf8mb4 [dbname] => drupal_testing [username] => MyUsername [password] => MyPassword ) [testing] => Array ( [key] => main_key [ip] => http://testing.example.com ) [displayErrorDetails] => 1 [addContentLengthHeader] => [determineRouteBeforeAppMiddleware] => 1 ) [defaultSettings] => Array ( [httpVersion] => 1.1 [responseChunkSize] => 4096 [outputBuffering] => append [determineRouteBeforeAppMiddleware] => [displayErrorDetails] => [addContentLengthHeader] => 1 [routerCacheFile] => ) ) [this] => Slim\Container Object *RECURSION* ) [router] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [environment] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) ) [request] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [response] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [callableResolver] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) [parameter] => Array ( [$container] => ) ) [foundHandler] => Closure Object ( [this] => Slim\DefaultServicesProvider Object ( ) ) ) [keys:Pimple\Container:private] => Array ( [settings] => 1 [environment] => 1 [request] => 1 [response] => 1 [router] => 1 [foundHandler] => 1 [phpErrorHandler] => 1 [errorHandler] => 1 [notFoundHandler] => 1 [notAllowedHandler] => 1 [callableResolver] => 1 [logger] => 1 [db] => 1 [view] => 1 ) )
-
I for no particular reason typically use: - myApplicationName - application/ - classes/ - components/ (from my start with Joomla, and I have a controller, model, view directory in each, however, I am thinking of moving away from) - includes/ - lib/ - js/ - css/ - images/ - etc/ - html/ - index.php - lib/ (a symbolic link to ./application/lib - logs/ - vendor/ - composer.json (and lock, etc) - config.ini - httpd.conf, private.conf, etc if I include with my Apache setup. - readme I've seen others that say: - myApplicationName - src/ - classes/ - includes/ - public/ - index.php - logs/ - vendor/ - composer.json (and lock, etc) - config.ini Is there anything like a recommended file structure?
-
I am building an add-on for Concrete5 who's purpose is to configure and display HighCharts. I will later be porting it to Wordpress and Joomla for their equivalent plugin and component. Much of the functionality of the add-on is provided by a remote REST API which the add-on communicates to using cURL, and the only thing the script on the Concrete5 machine does is: When displaying a page, make a request to the REST API, create a view and includes the results received in it, and provide that view to the overall Concrete5 view which is presented to the client. When an Ajax request is received, proxy it to the REST API, receive the results, and forward them back to the client. Host appropriate JavaScript files, and a small amount additional scope which can easily be moved to the REST API. This is making me question why I am creating any Concrete5 (and then Wordpress and Joomla) specific script. Maybe I should move everything to the remote REST API server. But how would it look? Would I then have same-origin issues? Is this not how PHP is suppose to work, and should I be using something like Node.js? PS. Sorry for the lame topic title, but I couldn't think of anything better.
-
I've never used unit testing, but am starting to try. https://phpunit.de/getting-started.html describes the primary means as a phar file, but then goes on to say it is possible to use composer. Should I use one over the other? Also, any recommendations on a good tutorial? I am not overly impressed with the official getting started document. Edit1. If it is done with composer, is it restricted to a single directory, or can it be made global? Edit2. I guess it could be made global. Not sure yet how this works, but will look into. Thanks
-
Understanding Dependency Injection
NotionCommotion replied to NotionCommotion's topic in PHP Coding Help
What I got out of Part 1..... Don't have a class create an object. Instead, create all the objects at the top, and inject them into the appropriate classes via the constructor when required or with a setter if they are option. While I see the value sometimes doing so, I am having a hard time embracing it across the board. How absolute is this? -
I recently upgraded from PHP5.5 to PHP5.6. I just noticed that PHPMailer is no longer working, and I get the following error: An error occurred in script '/var/www/application/classes_3rd/PHPMailer/class.smtp.php' on line 344: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (error no: 2). According to https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting: I have made the hack fix and it works, however, I would like to do it right and make sure SSL is configured correctly. When testing my URI on https://www.sslshopper.com/ssl-checker.html, it shows all green. Don't know if it matters, but I have a wildcard certificate (i.e. variable.fixed.example.com for any "variable"). My PHPMailer version is 5.2.12. variable.fixed.example.com resolves to 123.456.789.123 Server Type: Apache/2.2.15 (CentOS) The certificate should be trusted by all major web browsers (all the correct intermediate certificates are installed). The certificate was issued by StartCom. Write review of StartCom The certificate will expire in 148 days. The hostname (variable.fixed.example.com) is correctly listed in the certificate. Common name: fixed.example.com SANs: fixed.example.com, example.com, *.fixed.example.com Organization: Michael Reed Location: Bothell, Washington, US Valid from February 1, 2015 to February 1, 2017 Serial Number: xxx(0xxxx) Signature Algorithm: sha256WithRSAEncryption Issuer: StartCom Class 2 Primary Intermediate Server CA Common name: StartCom Class 2 Primary Intermediate Server CA Organization: StartCom Ltd. Location: IL Valid from October 24, 2007 to October 24, 2017 Serial Number: 27 (0x1b) Signature Algorithm: sha256WithRSAEncryption Issuer: StartCom Certification Authority Any recommendations? Thank you
-
I had been using the following script, but question whether I should bother as MySQL will not return duplicates. Is it better to just send MySQL everything, and let it deal with it? $input=[5,3,null,7,5,3,2]; if($input=array_values(array_filter(array_unique($input)))){ //Remove non-unique values, null values, and reorder $list=rtrim(str_repeat('?,',count($input)),','); $sql="SELECT a,b,c FROM my_table WHERE id IN ($list)"; //my_table.id has a NOT NULL constraint $stmt = $this->db->prepare($sql); $stmt->execute($input); }