Closed GeorgeFive closed 5 months ago
Is it better to use an array for all input parameters
Honestly, I'd say leave it as is for simplicity sake. At this point, I'm scared to play with the code too much, haha. This has been a silly experience, I had no idea there was a character limit there. The thought never even crossed my mind, even when I was taking stuff out and seeing it work.
Well it never crossed my mind either, never heard anything about this limit but as it happens we have to deal with it.
I don't really mind the image being gone, but I was wondering if we could build the query dynamically in case someone else wants it? We could put all of the query into a string (keeping spacing and readability). and then call it with something like...
$string = str_replace(' ', '', $string);
Removing all spacing for maximum character usage.
That is something that did cross my mind but for now lets keep it like it is. I moved edges to the left to create some extra wiggle room. Let's see if someone who use this class will ask for the image. After all it is a search class which produces results used for a list of titles, images is not really needed for that purpose
I found something to remove spaces from heredoc ($t is in our case $query)
function trimHereDoc($t)
{
return implode("\n", array_map('trim', explode("\n", $t)));
}
https://stackoverflow.com/questions/1655159/how-to-trim-each-line-in-a-heredoc-long-string-in-php
Untested for now but might be useful
Edit: I added this function and it works great! With all spaces in place the character count is 984 before and 650 after so a gain of over 300. This will add room for more constrains or more return values
@GeorgeFive can you test this one as well? upload is done
You mentioned advanced search in the caching thread.... this is one thing I would love to see from that: a list of the top X movies by genre, ie,
https://www.imdb.com/search/title/?genres=horror