-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
If you want the title of a video then use their API. That's why it exists: so you don't have to pull down full user-facing pages and scrape them for pieces of information. https://developers.google.com/youtube/v3/getting-started https://developers.google.com/youtube/v3/quickstart/php
-
In the long run, it's easier not to try to have one regex handling a bunch of different possibilities. Just make two separately: one for youtube.com and one for youtu.be.
-
The gradient runs from a single point in the center. Looking at the edges, the gradient will only be uniform if the container is in a circular shape itself - oval, I think. And even then, at 24px wide, you'll probably be stuck with some variation in gradient when comparing the outer and inner edges. In other words, it sounds like you need a different approach. I suggest keeping it simple: a special SVG that draws lines using your desired gradient, or go old-school and use plain images as in the days before CSS supported fancy borders.
-
You can't use a gradient as a color. You can apply it as a border-image-source, but that may take some playing around with. But I'm not even entirely sure what effect you're going for, or the overall size/shape of the element you're styling (which will have a huge impact on the appearance of a gradient border). Or else you can just use a second container element, set the gradient as a background on the parent, then add padding to create the border effect.
-
One-liners are great and all, but is it worth all the time you've spent on it so far? A simple foreach loop could have solved the problem hours ago.
-
Have you considered, perhaps, writing some code to do that?
-
Then either you didn't have PHP set up at all, and what you were seeing was the unexecuted source, or (I assume) you have some kind of logic like "if (form submitted) { do thing } else { show page }" and you weren't triggering the "form submitted" logic (thus it was returning the regular page instead).
-
Looks normal... You do Bearer authentication by just including an Authorization header in the request. Like if it was any other header. Was the 500 coming from your own site or from theirs? Presumably yours. A 500 means an error, so if you get that then check the server logs to find out what the error is so you can fix it. If the "HTML source" is of a page on their site then that likely means you were sending an incorrect request and/or to the wrong URL.
-
If your script is working correctly then there will always be output - except in the case that there was no "register" submitted with the form. So first thing is to check that. Otherwise you'll have some sort of error. Make sure your php.ini is set up appropriately for a development environment by ensuring it has these two settings: display_errors = on error_reporting = -1 (like at the bottom) and then restart PHP/the server/whatever you're using. You should then end up with a not-blank page...
-
1. Thank you for posting your reCAPTCHA secret to a public forum. Please cancel it and generate a new one immediately. And then don't publish it anywhere. 2. The URL you're constructing has two problems, but they're irrelevant because: 3. Per the documentation, you need to send a POST request to /siteverify. Not a GET request. Which typically means using cURL. If you still have problems, remember to post your updated code.
- 2 replies
-
- php
- recaptcha php error
-
(and 3 more)
Tagged with:
-
Is it possible you're not aware that foreach can give you both the keys and the values? That said, you shouldn't be going through every single entry in $_POST without verifying that it's good to add to your SQL. Really, you should be starting with the list of columns you want to support and then looking in $_POST to see what each one's value is.
- 2 replies
-
- pdo
- $_post variables
-
(and 1 more)
Tagged with:
-
GA4 - showing 2 versions of my homepage
requinix replied to CustomMadeCasino's topic in PHP Installation and Configuration
It'll be finding two versions because you do have two versions: it can't tell that the index.php one is "the homepage" and you're (I assume) using URL rewriting in the backend to map / to /index.php?route=common/home. Redirects are the answer, however they have to be very carefully done: redirect from the ?route= thing if that was the actual URL requested. Because if you don't have that little condition at the end, your server will redirect back and forth between them. How are your redirects set up now? -
Sounds like the preprocessing you're doing on your data, namely the $results array, doesn't suit your needs. Take a sample of your data and write it directly into your code, putting it into an array format that you can work with. Toy around with it until you get something that works. Then pull that stuff out and write code to generate the array from $data. Advice: it's totally okay to have something more complicated than a plain 3D array. array( some info here, sub data => array( maybe more info here, sub data => array( stuff ) ) )
-
PHP Mysql and Javascript - Copy paste for loop
requinix replied to PNewCode's topic in PHP Coding Help
That's correct: an ID will only ever refer to one element on the page, so using it for multiple elements is always incorrect. There's a simple solution for you here. Wrap the NOW PLAYING and the button (both) in a container element, then when the button is clicked, have it locate the container and then find the desired element to copy inside of it. IIRC: <div class="copy-container"> <div class="copy-target">NOW PLAYING: Something</div> <button class="copy-button">COPY</button> </div> <script> document .querySelectorAll(".copy-container") .forEach(container => { const target = container.querySelector(".copy-target"); const button = container.querySelector("btn.copy-button"); button.addEventListener("click", () => { copyToClipboard(target); }); }); </script> And please don't implement clipboard functions like that - use the actual Clipboard API instead. -
Moved. That is typically why people install Apache, or bundles like WAMP and XAMPP. First piece of advice is that generating HTML files is probably the wrong way to do this. How about some more information? What is it you're developing? What are these text files and HTML files?
-
Code your bot as a system service, as in something that runs on system startup and probably has a dependency or two (such as networking). Doing that also means the system can monitor the process and restart it if it fails. Yes, that means you need to spend a bit of time learning what those are and how they work, though that shouldn't take long. The only difference between a "normal" service and your bot's service is that the command to run your bot looks like "/usr/bin/php /path/to/your/bot.php".
-
Data not showing properly in correct header
requinix replied to CSS-Regex's topic in Javascript Help
A <tr> is a table row. A <td> is a table cell. If you want one row with multiple cells then you need one <tr> and multiple <td>s. -
That's floating-point arithmetic: the computer can't calculate 573.06 * 100 exactly so it comes up with something close. Something like 57305.9999999999986. And if you truncate that, like with an int cast, then you'll just get 57305. In other cases it might come up with 57306.00000000000005. The solution is super simple: round the number instead of truncating it. function convertToMoneyInteger($input) { return round($input * 100); } Be careful that your $input is never going to have fractional cents or you'll lose them by rounding to 0 digits. If you're concerned that might be possible, round to an appropriate number of decimal places.
-
Tip: if you want to use programming to make your work easier, you should try considering yourself a programmer. So, what have you tried to do so far?
-
1. What have you tried so far? 2. Are you aware that PHP has a variety of DNS functions already?
-
Feedback on Data model for Cinema ticket booking system
requinix replied to webdeveloper123's topic in Application Design
It's not possible to book a particular seat in the theater. (Most likely.) Instead, one has to book a particular seat in the theater for a particular screening. Thus the status must be associated with something that has both of those pieces of data. You don't have such an entity... basically. You could build one by creating a "screening_seat" table, consisting of a screening_id and seat_id. Rows could be created on-demand, removing the need to pre-populate that table when a screening is created. You would then adapt the booking_details to reference that screening_seat instead. However, if the status is a simple boolean "booked / not booked" then you don't need to store it because it can be inferred from the existence of a booking for a seat. In other words, with the current design, if there is a booking_details with seat_id = $seat and booking.screening_id = $screening then the seat is considered booked, and if not then the seat is considered free. -
You've posted bits and pieces. If there's nothing more to it and you've shown us everything then the answer is simple: you can't call PHP functions from Javascript like that. But I suspect you haven't posted everything. Please do.