I’m using Laravel and trying to send a form via XMLHttpRequest. It works but the request in the controller doesn’t identify it as ajax. The form has a csrf input. I’ve tried several things, right now my code looks like: But Laravel keeps sending a 419 | Page Expired response. Maybe I’m…
MongoDB & PHP | How to add into object that is inside an array?
I am new to MongoDB and PHP and I am trying to make an API. The current problem I have is that I am not able to add an array into an object that is inside an array (of objects). I have tried a lot, but all failed. This is the document I have so far: I would like to
Binary to Decimal 32bit signed with PHP
I currently have a Decimal that is coming through as: 4294960896 This is then converted to Binary with this function: Which equals: 11111111111111111110011100000000 I then need to take that binary and convert it to the 32bit signed version which should be ‘-6400’ I can’t seem to find any bui…
Laravel 9 html form submit throws 405. Expects PUT, request is GET
I’m trying to create a simple CRUD application with Laravel 9. I’ve run into a problem with HTML forms. I’ve created a page where you can edit data on rabbits existing in my database. My form web.php routes RabbitController.php Before I even hit the controller I get an exception reading: The…
WooCommerce Product SKU checking is not working
I am trying to create and update woocommerce products automatically from an API. I have created the starting point of the plugin and this is my method that gets the products from the external API and then loops through them and creates a simple product in woocoommerce. It creates the products perfectly fine h…
Serving a page to any URL that ends in its slug
Still new to WordPress, so please go easy on me. Goal: Prevent users of a specific role from viewing other custom post types made by users of same role. Intended solution: Modify the URL and redirect to a custom 403 page when the user ID doesn’t match the post author. As such, if the person attempting t…
Serve file from cache folder if it exists, otherwise rewrite to “index.php” using .htaccess
Suppose in root directory I have one file (called index.php) and one folder (called caches). I want that if the file exist in caches folder serve that file (caches/xxx.html) otherwise request send to index.php. For example I will send request to server: https://example.com/how-to-do and Apache search first in…
dynamically passing href in anchor tag
i want to redirect user to registration based on there role. like there is two roles user and shop if user select user role then it will be directed to the ragic.php(registration customer) if selected shop then ragis.php Hear is the code… one problem is how i pass a javascript variable into anchor href.…
How to remove multiple slashes in URI with ‘PREG’ [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago. Improve this question I am using str_replace() for removing extra slashes from url i dont know how to redirect t…
Checking the existing of a file by url inside native php router
I would like to know how could I check the existing of a file by a given url inside native php router (index.php) here is what I’ve tried : Inside (index.php) The page takes long time to output a message ‘Warning: get_headers(http://[website]/test): failed to open stream: HTTP request failed’…