Call external API in wordpress based on user input

I want to create a simple wordpress website in which I want to display a search box on a page. On searching a string in text/search box, an external API call should be made based on that string and the data returned by the API should be shown to user. I have successfully referred code from below URL so far – https://rapidapi.com/blog/integrate-external-api-wordpress/.

But I am not able to make a call to API based on string passed in text box. I have done below code so for in the child theme file page:-

<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>     <main id="main" <?php generate_do_element_classes( 'main' ); ?>>         <form action="" method="post">         Enter query:         <input type=text name="t1">         <br>         <br>         <input type=submit name="s">         <?php         /**          * generate_before_main_content hook.          *          * @since 0.1          */         do_action( 'generate_before_main_content' );          if(isset($  _POST['s'])){         echo "good";             $  curl = curl_init();          curl_setopt_array($  curl, [             CURLOPT_URL => "******API URL*****/".$  _POST['t1'],             CURLOPT_RETURNTRANSFER => true,             CURLOPT_FOLLOWLOCATION => true,             CURLOPT_ENCODING => "",             CURLOPT_MAXREDIRS => 10,             CURLOPT_TIMEOUT => 30,             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,             CURLOPT_CUSTOMREQUEST => "GET",             CURLOPT_HTTPHEADER => [                 "x-rapidapi-host: XYZ",                 "x-rapidapi-key: ABc"             ],         ]);          $  response = curl_exec($  curl);         $  err = curl_error($  curl);          curl_close($  curl);          if ($  err) {             echo "cURL Error #:" . $  err;         } else {             echo $  response;         }     }                           /**          * generate_after_main_content hook.          *          * @since 0.1          */         do_action( 'generate_after_main_content' );         ?>         </form>     </main> </div>  <?php /**  * generate_after_primary_content_area hook.  *  * @since 2.0  */ do_action( 'generate_after_primary_content_area' );  generate_construct_sidebars();  get_footer(); 

When I click on Submit button, it gives ‘Page not Found’.

WordPress: Call to undefined function wp_embed_register_handler()

I have a WordPress website that is still under development. I was working on this website till end of Feb, 2021 and hold all works due to COVID crises. Till that date, website was working. Now I have resumed my work and just looking into website. But now, website is throwing an error "Fatal error: Uncaught Error: Call to undefined function wp_embed_register_handler()"

I have also crossed the file "wp-includes/embed.php" file in which this function exists and function is already defined before calling it. You can see attached screenshot of whole error tracing.

enter image description here

I am not getting this error on all pages but almost every pages. I am not able to understand why I am getting this error even I have not touched anything on website from last 3-4 months. And it was working fine when I was working last.

Can someone please help on this? I am not very experienced in WordPress but have intermediate knowledge.

Thanks in Advance

Validate rest-api call on create

WordPress Site A has an API, which is being used by another system/application (B). B is struggling to handle/controle/sanitize the posts being sent to the API, and often cause creation of duplicates. B is really struggling to solve this in their end, so I was wondering if I can add a validation-method to the endpoint in my end.

The problem is that it needs to be a validation on a create-endpoint.


Example

This is how I imagines it would look on an update endpoint (not tested):

I’m calling the endpoint: https://example.org/wp-json/wp/v2/foobar/100007?title=Test Title&meta[custom_var]=10

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/(?P<id>\d+)', [     'methods'  => 'POST',     'args'     => [       'custom_var' => [         'validate_callback' => function( $  param, $  request, $  key ){           if( $  param > 5 ){             return true           }           return false;         },       ],     ],   ] ); } ); 

But I can’t find anything in the rest documentation about validating the create endpoint.

I imagined it being something like this:

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/', [     'methods'  => 'POST',     'validate_method' => function( ... ),     ...     ...     ...   ] ); } ); 

… But that doesn’t work.


I also considered doing the callback:

add_action( 'rest_api_init', function(){   register_rest_route( 'wp/v2', '/foobar/', [     'methods'  => 'POST',     'callback' => function( ... ),     ...     ...     ...   ] ); } ); 

But that callback fires after the post is created (I assumed).

After new user logs in or signs up, make a POST call in WordPress

What I am trying to achieve is this: after a user either signs in or signs up on my e-commerce site, I want to trigger a POST call to an endpoint on POSTMAN that will show the data like username, email, password, etc.

I am new to WordPress development so can someone help guide me to where to access the code on WordPress and furthermore make this POST call? Any help is much appreciated!

Also, I am using Woo Commerce if that factors in at all

Can SSIS packages call other SSIS packages in the connection string?

I am running an SSIS package that transfers data from one (SQL2008) server to another (SQL2000). However after P2V conversion the SQL2008 server cannot execute an SSIS package due to a user authentication error.

Lets say the package is called "Transfer-Go". In the connection string of that package can it call another SSIS package? In the SSIS library there is another package with the same that appears in the string (called Transfer-Now) name The string is below:

Data Source=<IP>;User ID=<user>;Initial Catalog=<db_name>;Provider=SQLNCLI10.1;Persist Security Info=True;OLE DB Services=-13;Auto Translate=False;Application Name=SSIS-<Transfer-Now-name of other SSIS package>-{8ABA18EE-637E-424F-A3F7-F7E4EA50DD9D}<IP.db_name.user>; 

So is this SSIS package connection string calling that package?

And if the credentials are wrong in that package could that be why I am unable to authenticate?

Thanks for any input, not a DB/SQL guy at all so I apologize if I sound green here.

MySQL – Call a View inside a Stored Procedure

Let’s say, I have a table as follows

tbl_1

id             name                 status               usertype                         flag ================================================================================================ 1              Name 1                  1                    2                               0 2              Name 2                  1                    3                               0 3              Name 3                  1                    1                               0 4              Name 4                  1                    4                               0 5              Name 5                  1                    5                               0  

HTML PAGE

<select id="type" name="type">    <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option>  </select> 

My requirement is that I need to get all the data from table where the usertype is selected from the html page by the user (could be 1, 2, 3,4,5, etc.)

I want to create a view, and call that inside stored procedure

I cannot pass an argument inside of a View. So, I was told to create a stored procedure, and call the view inside it. The problem is, I don’t know how to do it.

how to call lo_unlink(lo) in batches

I have a huge vacuum_l table filled with oids I can safely delete. As reported in the vacuumlo.c source code:

We don’t want to run each delete as an individual transaction, because the commit overhead would be high. However, since 9.0 the backend will acquire a lock per deleted LO, so deleting too many LOs per transaction risks running out of room in the shared-memory lock table. Accordingly, we delete up to transaction_limit LOs per transaction.

What is the best way to write a script iterating through the whole table and limiting the calls to lo_unlink() to n per transaction?

So far I tried to rewrite the vacuumlo.c sources in sql:

begin; DECLARE myportal CURSOR WITH HOLD FOR SELECT lo FROM vacuum_l; for recordvar IN myportal loop -- this won't work     begin;     FETCH FORWARD 500 FROM myportal;     -- call to lo_unlink() here     commit; end loop; 

Using vacuumlo utility is not an option for me since hybernate stored oids in text field.

Thanks for any help.

Can you cast Call Lightning while submerged underwater? [duplicate]

We are running an underwater campaign where everyone is an aquatic race, and most of the campaign will take place completely underwater. Call Lightning says:

"A storm cloud appears in the shape of a cylinder that is 10 feet tall with a 60-foot radius, centered on a point you can see within range directly above you. The spell fails if you can’t see a point in the air where the storm cloud could appear (for example, if you are in a room that can’t accommodate the cloud)."

Does this literally mean you must be able to see a point "in the air", or could this work beneath the waves?

Are there official rules for drugs and addiction in Call of Cthulhu?

I’m playing the 7ed version of Masks of Nyalethotep(sp?). I decided to have my character a laudanum user as he’s an opium addict, because I was certain there were rules about narcotics and drug addiction in Call of Cthulhu.

But now I can’t find any in the main rulebooks (I have 5th to 7th edition), investigator and keeper handbooks, or other sourcebooks and campaigns I have.

Are there any official rules for PCs using narcotics and for addiction?

If there are, which book are they in?

At the last session, myself and the GM decided to give my PC a penalty dice on skill and characteristic rules and movement, and to reduce the effects of Sanity rolls (sometimes he won’t make them, if he does the sanity costs might be reduced), when he’s under the influence of laudanum