Skip to main content
deleted 1 character in body
Source Link

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true (do NOT do this on the production server of your site).

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'"automatic&message=%2$s", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true (do NOT do this on the production server of your site).

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true (do NOT do this on the production server of your site).

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

added 55 characters in body
Source Link

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true (do NOT do this on the production server of your site).

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true.

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true (do NOT do this on the production server of your site).

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.

Source Link

I would suggest using the HTTP API that WordPress provides for this purpose. Take a look at the GETting data from an API section for more details on how to get the data from your URL.

To get started, try:

  • Navigate to your wp-config.php file, and set the WP_DEBUG and WP_DEBUG_LOG constants to true.

  • Next, replace your code with the following:

     function mysite_woocommerce_order_status_processing( $order_id ) {
    
         $billing_phone = "0729424391"; // TODO Sanitize this input
         $message = "yep"; // TODO Sanitize this input
         $url = sprintf( "http://realcam.club:9710/http/send-message?username=admin&password=admin&to=%1$s&messagetype=sms.automatic&message=%2$s'", $billing_phone, $message );
    
         try {
    
             // GET the response.
             $response = wp_remote_get( esc_url( $url ) );
    
             // If the response is a WP_Error object, jump to the catch clause.
             if ( is_wp_error( $response ) ) {
                 throw new UnexpectedValueException( $response->get_error_message() );
             }
    
             // Log the successful response to the debug log.
             error_log( print_r( $response, true ) );
    
         } catch ( UnexpectedValueException $e ) {
    
             // Log the error to the debug log.
             error_log( $e );
    
         }
    
    
     }
     add_action( "woocommerce_order_status_processing", "mysite_woocommerce_order_status_processing" );
    

and check what's in the debug.log file in the wp-content directory of your WordPress installation.

This code will log the response or, if the request was unsuccessful, an error message to that file. I think it is straightforward enough for you to understand, but if you do have any questions or if anything goes wrong, please let me know.