cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

on terminal write hp- then hit tab, you should see:

hp-align               hp-info                hp-query
hp-check               hp-levels              hp-scan
hp-clean               hp-logcapture          hp-setup
hp-colorcal            hp-makeuri             hp-testpage
hp-config_usb_printer  hp-pkservice           hp-timedate
hp-doctor              hp-plugin              hp-unload
hp-firmware            hp-plugin-ubuntu       
hp-hpdio               hp-probe        

Which are the utils installed by the hplip package, among them there is also the command hp-scan but you need to setup the printer, so try hp-info to see if it's detected... you can also install the GUI, package name is hplip-gui.

cereal 1,524 Nearly a Senior Poster Featured Poster

The error is generated by line 15:

 [5] //$img = $session_data['profile_picture'];
     ...
[15] $data['profile_picture']=array('profile_picture'=>$img);

You're using an undefined variable $img, which is commented at line 5.

cereal 1,524 Nearly a Senior Poster Featured Poster

No, it shouldn't happen, check the database error log to find some information:

It can happen if the database executable (mysqld) is killed while writing data to a table or for an unexpected shutdown of the computer. However there are many things to consider depending on the used engine, here are few links to InnoDB and MyISAM but you should check the documentation for each specific engine in use:

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Yes, check the W3C Validator: https://validator.w3.org/

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm not sure I've understood the problem and the request.

it won't work when i have time more than 2 hours

So if you do:

$next_program_times = $program_times + 3;

It will give problems? Or you refer to multiple program_times?

when i try this:

$next_program_times = '<span id="time', $show_id + 1, $program_times,;

it don't work

I see few problems here:

  1. if you end the string with a comma you will generate a parsing error for unexpected ;
  2. you can use commas to separate variables and strings when outputting the variables and strings but not to assign them to a variable, so change the above to:

    $next_program_times = '<span id="time' . $show_id + 1 . $program_times;
    

    But if you add an integer to the string you loose the <span tag and end with something that looks like 110:00 AM. So something more correct is:

    $abc = $show_id + 1;
    $next_program_times = '<span id="time' . $abc . $program_times;
    

    This will generate something like <span id="time11410:00 AM which is still wrong, as an id cannot contain a space character.

  3. I don't know how you set $show_id but I assume this is set outside the loop, so there are good chances that it will generate a group of same ids at least as in your original code that does not include the $program_times variable. An id attribute in HTML must be unique over the document, if you don't fix it you can encounter problems with javascript …

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, Slim Framework supports composer so you can get a pagination library from packagist.org or you write it by your self.

cereal 1,524 Nearly a Senior Poster Featured Poster

Don't know your current code but, you're using procedural style, so the first argument for mysqli_query() is the connection link, which is missing from your last pasted code. It was set in the first line of your original script but not at line 42. I forgot to point that particular. Try to add that and it should work fine:

$query = mysqli_query($db, $select . $Order);
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

use DateTime and DateInterval, like this:

<?php

    $time = '05:00 PM';
    $dt = (new Datetime($time))->add(new DateInterval('PT5H'))->format('g:i A');

    echo $dt; # outputs 10:00 PM

For more information check the documentation.

Docs about DateTime:

Docs about DateInterval:

@jkon sorry, just saw your answer!

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have to perform a select query inside the methods isUserExistscustomer() and $this->isUserExistsmobile() and return boolean TRUE or FALSE.

For example:

public function isUserExistsmobile($mobile_no)
{
    $stmt = $this->conn->prepare("SELECT id FROM np_system_users WHERE customer_mobileno = ?");
    $stmt->bind_param('s', $mobile_no);
    $stmt->execute();
    $stmt->store_result();

    return $stmt->num_rows > 0 ? TRUE : FALSE;
}

Do the same for the email. The mobile number should be trimmed, to avoid leading and trailing spaces that could trick the system and allow duplicates:

$mobile_no = trim($mobile_no);

You should also remove spaces, dashes, dots inside the string, i.e. convert 555-123 231 to 555123231 and you should match prefixes which can be expressed in two ways, for example the international prefix for USA is 001 which can be shorted to +1.

So here you should decide if the client can insert prefixes manually or by a dropdown menu (select tag), and if you want to reject the input which is not composed just by digits.

Regarding the trim() function the same applies to email addresses, where you should lower the case to avoid values like abc@some.tld and Abc@some.tld. You can use mb_strtolower() or the MySQL function LOWER(), however this depends also on the charset assigned to the table column:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

data loss means a file corruption because the server misses some packets from the transmission (for example caused by a timeout), in this case the uploaded file will result corrupted and the server will return an error because the received length is not the same of what was declared by the Content-Length header. So in this case the API should return an error code.

This does not depend on JSON, depends on the HTTP protocol.

Or you mean that the service will reduce compress high-res files? I now that Picasa does something similar with free accounts.

cereal 1,524 Nearly a Senior Poster Featured Poster

Add a javascript event listener, when the form changes submit the query through an AJAX request. To make it work correctly separate the query script so that it returns only the data you want to display in the page.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you have to use the comparison operator ==, at the moment you are using the assignment operator =.

cereal 1,524 Nearly a Senior Poster Featured Poster

Would setting the folder and file permission to 711 suffice?

Hmm, no this doesn't solve, because the request will be executed through the TCP/IP stack, so the owner of the process will be the web server or the PHP server (in case of PHP-FPM) and any client through a web request could start the backup procedure.

Usually a cron job should be set like this:

/usr/bin/php /var/www/path/to/testCronJobLIVE.php

Or by setting the shebang in the script to define the executable:

#!/usr/bin/env php

echo 'Hello';

And then simply pointing the script in the crontab interface:

/var/www/path/to/testCronJobLIVE.php

That way you can set the script outside the public_html directory. But if you still want to stick with TCP solution, then you could set an extra header with a string value to match, something like:

<?php

if( ! array_key_exists('HTTP_AUTHORIZATION', $_SERVER) || $_SERVER['HTTP_AUTHORIZATION'] != 'Donna')
{
    header("HTTP/1.1 403 Forbidden");
    die('Error: 403 Forbidden.');
}

# execute your code
print 'hello';
print PHP_EOL;

And at cron job level:

curl --header "Authorization: Donna" http://digitalmediasolutions.ie/course-updates/testCronJobLIVE.php

I'm not sure lynx can set custom headers as it is a browser. You could use curl as in my example or httpie:

http GET http://digitalmediasolutions.ie/course-updates/testCronJobLIVE.php "Authorization: Donna"

Is this secure? Not really, if the request is intercepted then the header could be read, unless you can send through https.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, the URI registered in your script and in your App defines the port number:

http://localhost:80/feedreader/fdposter.php

But in your browser (screenshot) the port number is missing:

http://localhost/feedreader/fdposter.php

If you're using port 80, then try to remove it from the App settings and from the script, as this is an implicit port number and could generate this kind of problems.

In other words, set the redirect URI in App settings and in your script to:

http://localhost/feedreader/fdposter.php
cereal 1,524 Nearly a Senior Poster Featured Poster

In Javascript this is never a simple task, at least for me, so I prefer to stick with libraries. While waiting for more appropriate suggestions, try with the difference() function in moments.js library:

Bye!

diafol commented: +rep for moment - brilliant I use it a lot +15
cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Also move the <script> block inside the body, place it just before the closing tag </body>. And the <script> cannot use self closing tag, add </script> to those loaded in the head section.

And at line 14 you're missing the closing parenthesis, so from:

$(document).ready(function(}{

To:

$(document).ready(function(){
diafol commented: Good spot. +0
cereal 1,524 Nearly a Senior Poster Featured Poster

The browser javascript console does not return any error? Can you show your code?

diafol commented: heh heh. blood from a stone. everytime +15
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you could use an each loop:

$('#updated_status').on('change', function () {
    var e = $(this).val();
    $.each(feedit, function (key, val) {
        if (e == val.value) {
            $('#comments').val(val.areatext);
        }
    });
});

Live example: http://jsfiddle.net/o3g8sp6c/

diafol commented: Simple - just as it should be. Nice. +15
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, use the href attribute to point the browser to the destination page:

<a href="another_page.html">Link to another page</a>

Some additional information:

Is this that you were searching for?

cereal 1,524 Nearly a Senior Poster Featured Poster

Assuming that $path is relative to the CodeIgniter main index.php file, then change path to:

$path = FCPATH . 'uploads/path/';

The constant FCPATH is defined in the index.php file. Then simply loop the $files array against unlink():

array_map('unlink', $files);

And that's all.

cereal 1,524 Nearly a Senior Poster Featured Poster

In addition: maybe you could use cipher.exe, read here:

savedlema commented: Ok, thank you. +2
cereal 1,524 Nearly a Senior Poster Featured Poster

Yup, change the value of the LANGUAGE_CODE constant, this is probably set in the config file included in the top of the script.

To verify if English is supported just check the ./lang/ directory, you should find a file like lang.admin.en.php, otherwise use one of the existing files in that directory to add the support.

Note: in linux file names are case sensitive.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, change TYPE with ENGINE and it should work.

TYPE has been removed from current syntax: https://bugs.mysql.com/bug.php?id=17501

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

at basic you should include the headers to define From and Reply-To, check example 2 of the documentation:

Where From is one of your emails and Reply-To the sender email and you will need a mailer application to send the message, like sendmail which is usually installed on linux and mac platforms. For windows I have no idea of which local solution you could use (maybe sendmail in cygwin?)

Additionally if your email requires the connection to an SMTP then mail() is not the best approach.

Pay attention to this point: if you're working on a script that will run on a remote server then check the hosting documentation (or ask to the support) if SMTP is required when sending an email from the registered domain. In that case read this thread:

In case the From header is populated by a gmail account, then SMTP is required, by not authenticating the script will fail.

And do a search on Daniweb, this argument has been discussed a lot of times.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you cannot do this, the HTML specification does not allow to set a value for the input file type element. Otherwise a website could try to access to any file in the local system of the client.

Here you can see the attributes that you can set:

cereal 1,524 Nearly a Senior Poster Featured Poster

You can set a cron job that calls a script that will execute the query to change the status, or if using MySQL you can use the event scheduler of the database, for more information read these links:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

I guess you are mixing things here: when you submit input through a form, you get a string, so here you are going to parse a string not a variable, only by evaluating the string you could execute it and get the variable value, but this is risky because the client can execute whatever.

You could use preg_match to match the assignment operator (=) but in PHP you can write variables like these:

${'a=b'} = 'hello';
$a = $b = $c = 'hello';

And it becomes very difficult to match the correct value: hello, instead of b/$b/$c.

I think a better approach is to use token_get_all():

But it requires a little workaround, you have to prepend the opening tag <?php to the received input otherwise it will parse it as HTML.

An example:

<?php

    $input  = '$a = "hello"';
    $input  = '<?php ' . $input;
    $parsed = token_get_all($input);
    $result = '';
    $tokens = array(
        T_DNUMBER,
        T_ENCAPSED_AND_WHITESPACE,
        T_LNUMBER,
        T_NUM_STRING,
        T_STRING
        );

    foreach($parsed as $key => $value)
    {
        if(is_array($value) && in_array($value[0], $tokens))
        {
            $result = $value[1];
            break;
        }
    }

    echo $result;

Which returns hello.

cereal 1,524 Nearly a Senior Poster Featured Poster

Heh! Good for you, at your age I barely knew about HTML...

It's like a fear to be intimidated by co-workers that I'm a novice or something like that.

Never fear, just be keen to learn from others. It can only improve your skills.

Gideon_1 commented: thanks cereal +3
cereal 1,524 Nearly a Senior Poster Featured Poster

I don't see any errors or Warnings. Should I be concerned ?

If the value is set then the script may exit for another reason, it could be memory exhausted or something else, check the error log file of PHP or set:

error_reporting(-1);

To get all errors, notices and warnings.

Above here i faced a problem if I select 100+ HD Photos it takes only 20 of them and puts them in the Folder and keeps only those 20 Records .... This was due to "max_execution_time" <----- I think but I am not sure, as the script runs for about 10 seconds max !!!!

If you prepended any function with the error control operator @, for example @file('...') you will not see that specific error, so temporary remove them to debug the script.

If you still don't get any errors then, if possible, share your code, this will help us to understand the issue.

I am using PHP 5.1

If possible upgrade PHP to latest version, PHP 5.1 last update was in 2006. Not good.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

to verify if your setting is applied you can use:

echo ini_get('max_execution_time');

Questions:

  • The timeout error is at PHP or database level?
  • Can you paste the error message and error code here?
  • And, if pertinent, which database and version of it, are you using?
cereal 1,524 Nearly a Senior Poster Featured Poster

Just replace the text with the input received from the form:

$message = $_POST['query']; # name of textarea

And then set the body:

$mail->Body = $message;

The same applies to subject and altbody (which is optional and helpful if in body you set an HTML message). To get the email address of the sender replace:

$mail->addAddress('office@---.com');

With:

$email = $_POST['email'];

$mail->addAddress($email);

For the moment get it to work, after that you MUST add validation and sanitazation, because at the moment the script is not safe against attacks. The validation & sanitazation process is not complex you just have to add some rules through filter_input(), as example:

$name    = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);

# sanitize
$email   = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);

# validate if sanitization was successful
$email   = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);

$message = filter_input(INPUT_POST, 'query', FILTER_SANITIZE_STRING);

Docs:

A sanitize filter is used to remove extra characters, like javascript, html tags, null bytes. A validation filter, instead, is used to verify that the input is in the correct format. When filter_input() fails it returns boolean FALSE, so after you set the variables $name, $email and $message you could verify the status of them and decide if run the mail script or not, so you should just replace:

if(!$mail->send()) {

with:

if($name !== FALSE && $email !== FALSE && $message !== FALSE && !$mail->send())

Or, better, you could place an independent if statement before …

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi, Date in the select list is a reserved word, you can use it if you wrap it in backticks.

Docs:

cereal 1,524 Nearly a Senior Poster Featured Poster

It could be the port or the password. Remove the comment character from line 12 to enable the debugger and access the information, with level 3 it will show the communications between server and client:

$mail->SMTPDebug = 3;

And also follow the link returned by the error:

It explains why the connection can fail.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you can use rm -rdf * it will remove all files and directories recursively. For more information about the options read the manual: man rm and be careful, always check current path, as it can hurt.

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Oh, you can create a separated script and included it, just place it on top of the file and check if the request method is POST, and if the submission comes from the contact form, for example:

<?php

    $result = FALSE;

    if($_POST && array_key_exists('action', $_POST))
    {
        # mail script here
        $result = require './send.php';
    }
?>
<!DOCTYPE html>
<html>
    ...

<?php if($result) echo "<p>{$result}</p>"; ?>

And at the end of the send.php script, instead of:

echo ! $mail->send() ? 'Error: ' . $mail->ErrorInfo : 'Success!';

You place a return:

return ! $mail->send() ? 'Error: ' . $mail->ErrorInfo : 'Success!';

Now the $result variable will carry the value returned by the included script.

Otherwise point the form directly to the script and then redirect back with a session message. It's up to you.

cereal 1,524 Nearly a Senior Poster Featured Poster

Let me try to explain: when you send an email message from your email client (for example Outlook or Mozilla Thunderbird) you connect to an SMTP server, submit password and if it's ok it will allow the sending of the message. You create the connection to SMTP and POP3 servers during the setup of the account, correct?

Now: when you send an email message from a PHP script you need to execute the same steps, otherwise, the SMTP server will deny the access and the email message will not be delivered.

At the moment at line 29 you are defining the FROM header basing on the sender email address:

$from="From: $name<$email>\r\nReturn-path: $email"; 

This is wrong, because this is the email defined by the client through your contact form. You don't have access to his credentials, so you cannot set the FROM header with his email address.

What you have to do is to:

  1. define, in your script, an email address that you can authenticate through a password, for example: web@website.com which will be used in the FROM header;
  2. use the Reply-To header to define the client email address, i.e. the value of the $email variable.

How to accomplish this? Use a PHP library that allows you to connect to your SMTP server. Something like PHPMailer:

An example:

<?php

require './PHPMailerAutoload.php';

$name    = $_REQUEST['name']; 
$email   = $_REQUEST['email']; 
$message = $_REQUEST['message']; 

$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;

# authentication
$mail->SMTPAuth  = TRUE;
$mail->Host      = …
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

it seems the same issue you had last month:

The sender email must be authenticated before sending the email. The email to authenticate is the one set in the FROM header, i.e. the one defined here:

$headers = "From: website@website.com" . "\r\n";

Free hostings solves this problem by replacing the FROM email address with their and by setting yours as REPLY_TO, so they don't have to authenticate your SMTP server. For this reason it appears to work fine. Check the headers of the test messages you have sent.

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

have you considered preg_replace()? Basic example:

<?php

    $s = 'google googler';
    echo preg_replace('/\bgoogle\b/i', 'go*gle', $s);

    # outputs: go*gle googler

With arrays it gets tricky because you have to write the pattern for each word to filter, but you can use an anonymous function to fix it, for example:

<?php

    $words = array(
        'google',
        'googler',
        'yahoo',
        'yahoos',
        );

    $replace = array(
        'go*gle',
        'yah*o'
        );

    $blacklist = array(
        'google',
        'yahoo'
        );

    $patterns = array_map(function($value) {
        return "/\b$value\b/i";
    }, $blacklist);

    $results = preg_replace($patterns, $replace, $words);
    print_r($results);

Returns:

Array
(
    [0] => go*gle
    [1] => googler
    [2] => yah*o
    [3] => yahoos
)

The anonymous function will create an array of patterns that looks like this:

Array
(
    [0] => /\bgoogle\b/i
    [1] => /\byahoo\b/i
)

The slashes / are delimiters. The \b is an escape character used to match the word boundaries, so the pattern used by preg_replace means: search only this specific word. The i is a modifier to use case insensitive search.

Docs
diafol commented: This is how to answer a question +15
cereal 1,524 Nearly a Senior Poster Featured Poster

You could use xpath() to match only the selected questions:

$xpath = $xml->xpath('//main[@select="selected"]');

So you can remove the IF statement:

if($main['select'] == "selected")

Then count to get the total and create a simple pagination system:

$count = count($xpath);
$page  = isset($_GET['page']) && $_GET['page'] > 0 ? $_GET['page'] : 1;
$numbr = $page - 1;

# load the current question
$main  = $xpath[$numbr];

Once you have $main, you don't need this loop:

foreach($xml->main as $main)

Then create the page links:

<ul class="nav">
    <?php
    for($i = 1; $i <= $count; $i++)
    {
        if($page == $i)
            echo "<li><a class=\"current\" href=\"question.php?page={$i}\">{$i}</a></li>";

        else
            echo "<li><a href=\"question.php?page={$i}\">{$i}</a></li>";
    }
    ?>
</ul>

And to your form code simply add the question id, which is the attribute id in the main object:

<input type="hidden" name="questionID" value="<?php echo $main->attributes()->id; ?>" />

Docs:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

you could count the nodes, create a range array and then shuffle the range, finally you return the node, for example:

<?php 

    $xml = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<main>
    <articles>
        <article>
            <title>Title 001</title>
            <content>Content 001</content>
        </article>
        <article>
            <title>Title 002</title>
            <content>Content 002</content>
        </article>
        <article>
            <title>Title 003</title>
            <content>Content 003</content>
        </article>
    </articles>
</main>
EOD;

    $load  = simplexml_load_string($xml);
    $count = $load->articles->article->count();

    if($count > 0)
    {
        $numbr = $count > 2 ? $count - 1 : $count;
        $range = range(0, $numbr);

        shuffle($range);

        echo $load->articles->article[$range[0]]->title . PHP_EOL;
    }

    else
    {
        echo "No articles found!";
    }

If you have doubts, please show your XML structure, otherwise it's difficult to help. Bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

No, open the main index.php file, in the first lines, depending on the CodeIgniter version in use, you should see (for version 2.*):

define('ENVIRONMENT', 'development');

while, for version 3.*:

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

Be sure the value is development.

Note

With version 3.* it's possible to push a server environment variable to define the environment through the .htaccess file. For example:

SetEnvIf Host www.domain.tld$ CI_ENV=production

The same can be applied at server config, so if you're using CI 3.* be sure your hosting is not setting this by default. It can be overridden by replacing the define() with the CI 2.* version code string.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok then what happens to the page? Is it blank? Try to change the ENVIRONMENT to development that should show the errors, this can be set in the index.php page, otherwise check CI error log.

cereal 1,524 Nearly a Senior Poster Featured Poster

@phoenix

that's why I was writing about prepared statements, the quote is not supposed to be submitted to the query, unless is escaped correctly, and that's why the security test was generating the syntax error, they supposed you where using quotes in your query:

"SELECT * FROM items WHERE ITEM = '$ITEM'"

So they tried to escape them by submitting the number with a quote:

71'

To get a query like this:

"SELECT * FROM items WHERE ITEM = '71''"

Which seems to not make sense but if you add other instructions right after the quote, you could execute whatever you want:

71' OR '1'='1

for example. At the end the query will look like this:

"SELECT * FROM items WHERE ITEM = '71' OR '1'='1'"

To solve with MySQLi you can use prepared statements or you can escape the input with mysqli_real_escape_string():

$id = mysqli_real_escape_string($con, $id);
$item_query = mysqli_query($con ,"SELECT * FROM product WHERE item_id = $id ");

Docs:

cereal 1,524 Nearly a Senior Poster Featured Poster

Hi,

I would like to help, if you can, send me the link.

cereal 1,524 Nearly a Senior Poster Featured Poster

My local system being my cell phone ?

No, it should be a computer in your local network, this will use a script to get the information from the remote database, then it will connect to your cell phone, through the script you posted in your first post, basically it would look like this:

    # pulling from remote

    +----------------+       +--------+       +---------------------+
    |Remote Database |  <--> | Router |  <--> |     Local system    |
    +----------------+       +--------+       |[PC with PHP scripts]|
                                              +---------------------+

                                                      +            
                                                      |            
                                                      |            
                                                      v            

                                                +------------+     
                                                |SMS Gateway |     
                                                |  [Phone]   |     
                                                +------------+     

If, instead, you redirect the connection from the router to the SMS gateway, then you won't need a local server and you could submit the input directly to the gateway:

    # receiving from remote

    +----------------+        +----------------+      +-----------------+
    |Remote Database |  +-->  | Router         | +--> | SMS Gateway     |
    +----------------+        | Public IP:PORT |      | Private IP:PORT |
                              +----------------+      +-----------------+

As suggested in my first post check the documentation of your router about the NAT or DMZ configuration, and if you need help tell us model and version.

A part this I cannot help much further, for me this is more a network issue rather than programming. Maybe you want to ask support to the Networking forum:

anitg commented: Very clear explanation +0
cereal 1,524 Nearly a Senior Poster Featured Poster

No problem, with patience we can try to fix it.

Until the SMS gateway is behind your router the only methods to access it directly are those already suggested in my previous answer.

There are other solutions among these: you could create a feed (for example an RSS feed) in the remote server to be read by your local system, or simply query the remote database, for example, every N minutes. The pros of this solution is that the remote server doesn't need to know the IP of the local server, nor your public IP. The cons is that the execution is not synchronous.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, when connecting to your public IP from remote you're connnecting to the router, what you have to do is to redirect the connection from the router to the internal server IP, this is defined as network address translation (NAT).

In practice in your router there should be an interface in which you can define the internal IP and the port, so that the request comining from remote acts like this:

REMOTE_REQUEST ===> [ROUTER]PUBLIC_IP:PORT ===> [SMS SERVER]INTERNAL_IP:PORT

Another solution is to set the SMS server in the DMZ and expose it directly to the internet:

Check the documentation of your router, if you need help let us know the model and version.