PHP - How Do You Receive A Message Over Https?
Not sure if my title line was worded correctly, but here is what I am trying to understand...
I need to hook my website up to a payment gateway to accept credit cards. After I package up the customer's payment details and send the payment gateway an XML string, their server supposedly sends back a request for more information OR it indicates a Pass/Fail message. This is where I am getting lost. If I send data over HTTPS using POST, then how am I supposed to receive a message back from them? It's not like we are on the telephone and there is a "live" link between my web server and theirs?! Can someone please explain how this works? Thanks, Debbie Similar TutorialsHello, i want to send and receive data from https url. how it can be done in php? Thanks Hi, I have been exploring twilio for an app that should be able to receive and store a text message. Do I need a SMS gateway to accomplish this? Thank you V. An automated API is sending an XML message to a PHP file on my site. How do I deal with this? Hi, Anyone can help me on how to receive a file as a http upload? I have an application that sends an xml file with http (post method) to our server and I need to make a script that receives that, writes it to database and archives the file away. Tried to google something but no luck so far. If anyone have done something like this I appreciate any help you can give. Thanks. $msg = "testing message"; $to = "$email"; $subjects = "testing"; $mailheaders = "From : singapore \n"; mail($to, $subjects, $msg, $mailheaders); Received in the email From : server name Question is I need it to receive as my domain name (FROM). Not the server name (FROM). Hey folks, I made a small shopping cart but I struggle with receiving an email with the orders; thanks in advance this is the mail.php <?php session_start(); if($_POST['sendemail'] == 'Email') { $headers = 'From: Sender <andrej13@gmail.com>'; mail('andrej13@gmail.com', 'Subject', $_SESSION["cart"], $headers); echo "DEBdsUG".$_POST["cart"]; echo 'Your mail has been sent'; } else { echo 'Your mail was not sent'; } ?> this is the cart.php <?php // Include MySQL class require_once('inc/mysql.class.php'); // Include database connection require_once('inc/global.inc.php'); // Include functions require_once('inc/functions.inc.php'); // Start the session session_start(); // Process actions $cart = $_SESSION['cart']; $action = $_GET['action']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP Shopping Cart Demo &#0183; Cart</title> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div id="shoppingcart"> <h1>Your Shopping Cart</h1> <?php echo writeShoppingCart(); ?> </div> <div id="contents"> <h1>Please check quantities...</h1> <?php echo showCart(); ?> <p><a href="index.php">Back to bookshop...</a></p> <form action="mail.php" method="post"> <input type="submit" name="sendemail" value="Email" /> <input type="hidden" name="cart" value="<?= $cart; ?>" /> </form> </div> </body> </html> Hey, I'm trying to send a form input to a page, and then get the response (as in, the body) from that page without leaving my PHP script. So instead of when you normally submit a form and it will take you to the 'action="/somepage"'. I want it to get that information and bring it back to the original page. No navigation should happen. I'm almost certain this is possible, but the only thing I've found at the moment requires a custom addon - which, isn't on most hosting sites. Sorry if I haven't described this very well, but any help would be appreciated Thanks tree Hi guys, I am having a problem of deleting the rows in the database. I just receive two warnings of mysql_real_escape_string which they a Code: [Select] Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'myusername'@'localhost' (using password: NO) in /home/username/public_html/mysite.com/delete.php on line 11 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/username/public_html/mysite.com/delete.php on line 11 failed The error are jumping on this line: Code: [Select] return mysql_real_escape_string($value); Here it the full code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'username'); define('DB_PASSWORD', 'password'); define('DB_DATABASE', 'databasename'); function clean($value) { return mysql_real_escape_string($value); } $id = clean($_GET['id']); if ($id != NULL) { $query = @mysql_db_query(_DB,"DELETE FROM table1 WHERE $id = 'id"); $deleted = @mysql_affected_rows(); if($deleted > 0) { echo("worked"); } else { echo("failed"); } }else{ echo("failed"); } @mysql_close($link); ?> I have input the correct password, so what's wrong?? i want receive this API JSON : "https://api.cryptowat.ch/markets/binance/btcusdt/ohlc" in PHP And put it in a variable . so i did this :
<?php $json= file_get_contents('https://api.cryptowat.ch/markets/binance/btcusdt/ohlc'); $json= json_decode($json , true); foreach ($json as $row){ $price = $row['86400'] ?? ""; print_r($price) ; } and its worked ! but i want to show a specific price like : 86400 / 1122 / 0 and i don't know how ? Hello I am a total beginner and don't know first thing about php, but still trying to figure this out. So what I am trying to achieve is, send a http request from a software to my website with a ticket number, is it possible in php to receive that request and show it on a different webpage of the same site? It would be helpful if you can point me to some related articles. I have created a simple form that collects a comment or question from a visitor to my website. The problem is that if the visitor types: Your site looks Ok. I will get that message. But if the type: Your site needs "Work". I will get: Your site needs The script will not send the double quotes or anything after the double quotes What am I missing??? I have tried: addslashes() str_replace() preg_replace() with on change to the message. This is the script Code: [Select] <?php $recipient = $_POST['recipient']; $subject = $_POST['subject']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $senders_email_address = $_POST['senders_email_address']; $comments = $_POST['comments']; $mailheaders .= "To: Thin Dime Web. <$recipient>\n"; $mailheaders .= "From: $first_name $last_name <$senders_email_address>\n"; $body .= "Subject: $subject\n\n"; $body .= "Senders Name: $first_name $last_name\n"; $body .= "E-mail Address: $senders_email_address\n\n"; $body .= "The following Comments or Question came from a visitor to your website\n"; $body .= "\n"; $body .= "$comments\n"; mail("$recipient", "$subject", "$body", "$mailheaders"); ?> Hi, didnt know how to add this to the repository so can an admin move this please. this updated version will tell you still when you recieve a visitor but to identify who i have included so that it tracks the ip and tells you when its you!!! <?php // Script to email you when Google refers traffic to your site. $name=""; // add your name here $email_address=""; // add your email address here $keywords=""; $referrer=$_SERVER['HTTP_REFERER']; $known_ips = array( '01.01.01.01' => 'from the computer your are at now!', // etc. ); $ip = $_SERVER['REMOTE_ADDR']; if (array_key_exists($ip, $known_ips)) { $ip = $known_ips[$ip]; // you may want to use a different var name here now? } if( (stristr($referrer, "google")) && (stristr($referrer, "search")) ) { parse_str($referrer, $output); $keywords=$output['q']; $email_message="A visitor just arrived to the website after searching for '$keywords', Their IP address is '$ip'. ($referrer)"; mail ("$email_address","Google referred a visitor","$email_message"); } ?> hope it all works... give it a try and let me know. Hi, I'm working on a web application that will interact with an existing website from another company. On the other company's site, there will be a form (using POST) that has my web application as the action element. The user who clicked the submit button will be redirected to my site, where I need to receive the $_POST data from this form to process before redirecting into the web application. I have done work on the other side, using standard form posts to send data to another site, but I've never had to write the code for the receiving end. How do I receive the form data posted from the other website? Can I access the $_POST[''] array as I would with any normal same-site POST transaction? Please let me know if you need additional detail or if my question wasn't clear! I'm fast approaching deadlines and really appreciate your help! Thanks! so i have a number of websites on a server all work fine but when i put https://
in front of the other sites on the website's it redirects to another site on the server without changing domain name.
example:
http://www.example.com
works fine
https://www.example.com
shows another site on the server
how can i stop this?
i tryed mod rewrites in htaccess but somehow isnt working?
Hello,
I cannot work out this one.
I am loading a css file on an https page as:
<link rel="stylesheet" type="text/css" href="/assets/fa687e60/jui/css/base/jquery-ui.css" />
But using the chrome element tool I see this error:
The page at 'https://mysite.com/deal/create' was loaded over HTTPS, but displayed insecure content from 'http://mysite.com/cs...bf9ee_1x400.png': this content should also be loaded over HTTPS.
Now I went in the css file and the code is like that:
.ui-state-highlight, .ui-widget-content .ui-state-highlight, Anyone know how to force URL with SSL with www.
<rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions><add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://www.site.com/{R:0}" redirectType="SeeOther" /> </rule> </rules> </rewrite>Please check the sample. I'm trying to determine the best way to provide HTTPS access to a web application that I'm building. I know that you can use the following code to redirect anyone manually accessing the http version of an https page: Code: [Select] if($_SERVER["HTTPS"] != "on") { header("HTTP/1.1 301 Moved Permanently"); header("Location: "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); exit(); } I have also heard that you could use mod_rewrite in Apache to achieve similar results. The entire web application should use https so I just want to make sure that I'm setting this up correctly. Feedback on the best approach or other suggestions would be very helpful. Thanks in advance. Apache https setup!
Okay so i made my own SSL certificate for my localhost using these commands
OpenSSL: ( CMD > c:\xampp\apache\bin\openssl )
req -config c:\xampp\php\extras\ssl\openssl.cnf -new -out jobnow.csr -keyout jobnow.pem rsa -in jobnow.pem -out c:\jobnow.key x509 -in jobnow.csr -out jobnow.crt -req -signkey c:\jobnow.key -days 369when asked for common name type your ip address. Then i install import the certificate to certmgr.msc Restate Apache https//192.168.0.14 - Doesnt work 192.168.0.14 - Works fine Apache error log: [Wed Sep 10 12:05:41.299000 2014] [ssl:warn] [pid 7840:tid 260] AH01909: RSA certificate configured for localhost:80 does NOT include an ID which matches the server name [Wed Sep 10 12:05:41.301000 2014] [ssl:warn] [pid 7840:tid 260] AH01909: RSA certificate configured for 192.168.0.14:443 does NOT include an ID which matches the server name [Wed Sep 10 12:05:41.301000 2014] [ssl:warn] [pid 7840:tid 260] AH01915: Init: (localhost:80) You configured HTTPS(443) on the standard HTTP(80) port! [Wed Sep 10 12:05:41.373000 2014] [co warn] [pid 7840:tid 260] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Wed Sep 10 12:05:41.616000 2014] [ssl:warn] [pid 7840:tid 260] AH01909: RSA certificate configured for localhost:80 does NOT include an ID which matches the server name [Wed Sep 10 12:05:41.617000 2014] [ssl:warn] [pid 7840:tid 260] AH01909: RSA certificate configured for 192.168.0.14:443 does NOT include an ID which matches the server name [Wed Sep 10 12:05:41.617000 2014] [ssl:warn] [pid 7840:tid 260] AH01915: Init: (localhost:80) You configured HTTPS(443) on the standard HTTP(80) port! [Wed Sep 10 12:05:41.659000 2014] [mpm_winnt:notice] [pid 7840:tid 260] AH00455: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 configured -- resuming normal operations [Wed Sep 10 12:05:41.659000 2014] [mpm_winnt:notice] [pid 7840:tid 260] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01 [Wed Sep 10 12:05:41.659000 2014] [co notice] [pid 7840:tid 260] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache' [Wed Sep 10 12:05:41.661000 2014] [mpm_winnt:notice] [pid 7840:tid 260] AH00418: Parent: Created child process 7032 [Wed Sep 10 12:05:42.319000 2014] [ssl:warn] [pid 7032:tid 272] AH01909: RSA certificate configured for localhost:80 does NOT include an ID which matches the server name [Wed Sep 10 12:05:42.321000 2014] [ssl:warn] [pid 7032:tid 272] AH01909: RSA certificate configured for 192.168.0.14:443 does NOT include an ID which matches the server name [Wed Sep 10 12:05:42.321000 2014] [ssl:warn] [pid 7032:tid 272] AH01915: Init: (localhost:80) You configured HTTPS(443) on the standard HTTP(80) port! [Wed Sep 10 12:05:42.645000 2014] [ssl:warn] [pid 7032:tid 272] AH01909: RSA certificate configured for localhost:80 does NOT include an ID which matches the server name [Wed Sep 10 12:05:42.646000 2014] [ssl:warn] [pid 7032:tid 272] AH01909: RSA certificate configured for 192.168.0.14:443 does NOT include an ID which matches the server name [Wed Sep 10 12:05:42.646000 2014] [ssl:warn] [pid 7032:tid 272] AH01915: Init: (localhost:80) You configured HTTPS(443) on the standard HTTP(80) port! [Wed Sep 10 12:05:42.688000 2014] [mpm_winnt:notice] [pid 7032:tid 272] AH00354: Child: Starting 150 worker threads. [Wed Sep 10 12:05:54.589000 2014] [authz_co error] [pid 7032:tid 1652] [client 192.168.0.14:3112] AH01630: client denied by server configuration: C:/xampp/htdocs/ [Wed Sep 10 12:05:54.682000 2014] [authz_co error] [pid 7032:tid 1652] [client 192.168.0.14:3112] AH01630: client denied by server configuration: C:/xampp/htdocs/favicon.icoIt says my server name does not match, So i changed the server name to: ( httpd-ssl.conf ) around line 80 ServerName 192.168.0.14:443 DocumentRoot to my httpd.conf document root My .key is in apache/conf/ssl.key my crt is in apache/conf/ssl.crt I hope this helps someone else! i had to post this after how much trouble it was causing me! Hi Everyone,
I am really struggling with this.....Cannot find a solution anywhere.
I have a website with SSL installed.
I would like to force SSL on the whole website but not on 2 urls.
If my whole site is https://mysite.com
and the 2 urls to disable from the SSL a
http://mysite.com/hotels
http://mysite.com/weather
How can I do it via htaccess please?
Thank you so much,
Ben
|