PHP - Server Port?
Stupid question but why would it need the port contained inside the URL for redirection later on?
Code: [Select] /* The servername and serverport tells PayPal where the buyer should be directed back to after authorizing payment. In this case, its the local webserver that is running this script Using the servername and serverport, the return URL is the first portion of the URL that buyers will return to after authorizing payment */ $serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; $url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']); Similar TutorialsHello Is it possible to uses PHP, to grap incoming packets from a port, on the PHP server ?? hello and good day dear php-freaks which is the passwd for the mysql db run opensuse - therein i have installed a myql serfver and an apache now i want to port over a cms-system from a server to the localhost. question: the passwd of the configuriatin of the cms has got the following db connecgtion host : localhost db-name db-passwd question: does the db passwd need to match the passwd of the local mysql server!? is this true love to hear from you Hi All - I'm trying to see if the below is possible using PHP. is it possible for php to allow a user to check if a port is open/listening on a remote server/PC, from their local machine. I've seen scripts on the web that talk about opening cmd.exe - this won't work as not all of my users will be on windows. Also saw fsock.. but the remote server is not serving http page(s). Also saw telnet, but again, some of my users may not have that windows feature enabled. Desired workflow: 1. user enters the server hostname/IP and a port 2. my php webapp will emulate checking if that hostname and port is open from the local user's computer.
thanks! Hi, I upgraded my XAMPP to the version 1.8.3 (win32) recently. Apache failed to start and I got the following error Hello, I have a webpage that runs some php code to control electrical devices. One part of it controls outside lights. Another part controls an electric door striker. I keep expanding the functionality of it and need to change one pin of the port without affecting the others. So far I use a different port for each function but I am out of ports so I need to use the different pins of the parallel port. I am using a linux ubuntu server. From my php webpage I issue this command: <?php exec("/home/setSerialSignal /dev/ttyS0 0 0"); ?> which controls the lights using the serial port. I can control 2 pins but I can't check the status of them so if I make a change to one pin it cancels the other. For another one I use the parallel port with this command: <?php exec("/home/parashell 0x378 1"); ?> which turns on pin #2 of the parallel port. Parashell has an executable called "pin". If you type the command "pin 0x378" it will return a value for the status of the parallel port. "1" for example which tells me that pin #2 is on. Is there a way to pass this value to a php variable? I am looking to be able to read the status of the port and make changes to just the pin I want. Lets say pin #2 is on and I want to turn pin #3 on. I would have to issue <?php exec("/home/parashell 0x378 2"); ?> to turn pin #3 on, but that would turn off pin #2. If I could pass the "1" from the "pin" command I could add it to the "2" and give it the command with a variable as "3". Thanks in advance for any help you can give. I hope I explained it ok and didn't confuse everyone. Hi!
I'm trying to make an button that when it's pressed sends an http post to my home server. But my home server is runing on port 84 and i think that i'm not being able to send the post correctly because of this port. any help?
my code now is this:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://homeserver.net:84/?device=35"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch);The way I have the URL is correct? thanks! Hi all,
I want to send a string of data to serial port. Below is the code. Sdata contains the string. for example "<LT-ON-50>".
<?php exec("mode com3: BAUD=600 PARITY=n DATA=8 STOP=1 to=off dtr=off rts=off"); if (isset($_GET['action'])) { $SData = $_GET['action']; $fp = fopen("com3","w"); fwrite($fp,$SData); fclose($fp); } ?>unfortunately, it will send only one character i.e '<'. the remaining characters will be lost. What could be wrong in the code. Any help can be greatly appreciated. Thanks, Okay, I'm using fsockopen to see if a port is being used, But all it does it crashes the page if it isn't. If it is one it works but if it is off the pages just doesn't load at all. Code: <?php $fp=fsockopen("localhost", 43594, $errno, $errstr, 30); if($fp){ echo('The server is <font color="#0066FF"><b>Online!</b></font>'); } else { echo('The server is <font color="#FF0000"><b>Offline!</b></font>'); } ?> Can one of you amazing helpful souls help me out? Thanks in advance! hello and good day dear joomla-experts well i want to add a business-directory to joomla and want to run this below mentioned code on overpass-turbo.eu see this http://overpass-turbo.eu/s/5pv and include the results into businessdirectory see the option for the code http://overpass-turbo.eu/ [adiff:"2014-07-01T00:00:00Z"]; area[name="Argentina"][boundary=administrative]->.a; ( node (area.a) [amenity=school][website]; way (area.a) [amenity=school][website]; ); out meta geom; and then see the results <?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="Overpass API"> <note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note> <meta osm_base="2014-10-12T14:10:02Z" areas="2014-10-12T03:37:02Z"/> <action type="modify"> <old> <node id="961544799" lat="-34.6064077" lon="-58.3749056" version="4" timestamp="2013-10-04T06:43:38Z" changeset="18172855" uid="79602" user="Zalitoar"> <tag k="addr:housenumber" v="165"/> <tag k="addr:street" v="Florida"/> <tag k="amenity" v="school"/> <tag k="name" v="IBL - International Bureau of Language"/> <tag k="website" v="http://www.ibl.com.ar"/> </node> </old> <new> <node id="961544799" lat="-34.6065440" lon="-58.3750010" version="5" timestamp="2014-07-11T17:43:16Z" changeset="24086663" uid="79602" user="Zalitoar"> <tag k="addr:housenumber" v="165"/> <tag k="addr:street" v="Florida"/> <tag k="amenity" v="school"/> <tag k="name" v="IBL - International Bureau of Language"/> <tag k="website" v="http://www.ibl.com.ar"/> </node> </new> </action> <action type="modify"> <old> <node id="2512237096" lat="-34.5636728" lon="-58.4422897" version="2" timestamp="2014-01-30T22:19:42Z" changeset="20291654" uid="255141" user="Souchong"> <tag k="addr:housenumber" v="1395"/> <tag k="addr:street" v="Avenida Luis María Campos"/> <tag k="amenity" v="school"/> <tag k="name" v="Método DeRose Belgrano"/> <tag k="phone" v="+54 11 47854882"/> <tag k="website" v="http://derosebelgrano.com.ar/"/> </node> </old> <new> <node id="2512237096" lat="-34.5636835" lon="-58.4423120" version="3" timestamp="2014-08-23T04:01:26Z" changeset="24947372" uid="331218" user="AgusQui"> <tag k="addr:housenumber" v="1395"/> <tag k="addr:street" v="Avenida Luis María Campos"/> <tag k="amenity" v="school"/> <tag k="name" v="Método DeRose Belgrano"/> <tag k="phone" v="+54 11 47854882"/> <tag k="website" v="http://derosebelgrano.com.ar/"/> </node> </new> </action> <action type="create"> <node id="2934940034" lat="-34.6181407" lon="-58.5235741" version="2" timestamp="2014-08-06T03:29:38Z" changeset="24567582" uid="648570" user="Abejo"> <tag k="addr:housenumber" v="5490"/> <tag k="addr:street" v="Simbrón"/> <tag k="amenity" v="school"/> <tag k="name" v="I.M.E.P."/> <tag k="phone" v="+54 011 45676610"/> <tag k="website" v="http://formarfuturo.org.ar"/> </node> </action> <action ty i love to do this - many many thanks for all help Hi, I'm trying to connect to a database on a port other than 3306 to create a database. Here's my connect code: $connection = new MySQLi($host,$user,$pass)() But according to the PHP website it says I can lay the code out like so: new MySQLi($host,$user,$pass,$database,$port)() But how do I specify the port without the database? I've tried just "" as the database but the connection still fails. Any help would be much appreciated. Hi. I am writing a web app to control Zoom Player on my HTPC. I found that ZP supports listening on a TCP port to accept control commands. The docs say to quit ZP, send 5100,fnExit + ASCII 13/10 to port 4769. My original client was C# and I implemented it there, works great. I then realized WTF am I doing using an external .EXE to just send data to a TCP port? Switched to using PHP's fsockopen. Alas, that causes an error to pop up on ZP (List index out of bounds or some such). Perplexed, I wrote a GUI for the HTPC to just display an ASCII val breakdown of what it receives to compa So it looks like they both send the data the same. Any idea why the discrepancy? Here is the code: C# that works: Code: [Select] string cmdstr = ""; for (int x=2; x<=args.Length-1; x++) cmdstr += args[x] + " "; if (SendCommand(args[0], System.Convert.ToInt16(args[1]), cmdstr.Trim() + Environment.NewLine)) Console.WriteLine("Command string sent."); Environment.Exit(0); static bool SendCommand(string dest, int port, string cmd) { try { IPAddress[] ips = Dns.GetHostAddresses(dest); TcpClient client = new TcpClient(); IPEndPoint serverEndPoint = new IPEndPoint(ips[0], port); client.Connect(serverEndPoint); NetworkStream clientStream = client.GetStream(); ASCIIEncoding encoder = new ASCIIEncoding(); byte[] buffer = encoder.GetBytes(cmd); clientStream.Write(buffer, 0, buffer.Length); clientStream.Flush(); clientStream.Close(); clientStream.Dispose(); client.Close(); return true; } catch (Exception ex) { Console.WriteLine("Failed: " + ex.Message); return false; } } The PHP that is being difficult: Code: [Select] send_data("lioth", "4769", "5100,fnExit"); function send_data($host,$port,$data='') { $fp = fsockopen($host,$port); if($fp) { fputs($fp, "$data\r\n"); fclose($fp); } return; } I have a small project. I have a control board that is connected to the parallel port. It controls 8 strips of LED on the LPT1 port. I can turn these on and off via the command prompt, using LPTOUT.exe ie lptout 1 turns on the 1st LED lptout 2 will turn off 1st LED and turn on 2nd, lptout 4 turns on 3rd and 2nd off, etc 1, 2, 4, 8, 16, 32, 64, 128. and combinations ie lptout 3 turns on LEDS 1 and 2, and so on. However lptout seems very unresponsive sometimes I have to do lptout 1 twice before LED 1 turns on. Is there another command I can use to write to LPT1 port. I need some PHP code to control the outputs. I want to sequence the outputs ie 1on (1second) 2on (1 second) 3 on (1 second) 4 on etc. to 8, then all off then repeat. Can anyone help me. THANK YOU. how to arrange a port forward via ssh-tunnel i need to do that on a domain with this syntax https://www2.mydomain.org:2211/ i am on opensuse guess that i firstly have to activate the ssh Hello guys, I am new to PHP programming. I am trying to figure out how to use PHP language to transmit/write characters to a USB port device at 9600 baud rate 8-N-1. Basically I just need the PHP coding to allow me to send stuff to the USB device but I have no idea how I can interface this. I did some researching but most were for RS-232 COM Port. I can't find the proper one for USB. If someone can help me out, that would be awesome. Thank you! I have a PHP web system that store in a windows server. In the system, there is a function for user to upload files to another server (Shared server in Unix). When i try to upload a file, it gives warning: Warning: move_uploaded_file(\\unixserver/sharedfolder/upload/test.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\wamp\www\upload\index.php on line 40 For your information, my username has been assigned in xxx's group that has access to read and write on that folder. Besides, i'm able to open,create and delete files on that folder's server manually (samba). The safe mode setting is off. Does anybody has any idea why this thing happen? I'm trying to make a simple website where people register to my website. When the user doesn't fill anything inside the boxes they get a message "Please fill all required fields" on the register.php page On my local host require_once works good. It shows up.
But when i upload the files to my sever the require_once does not show up on the register.php It just refreshes and i dont get the message "Please fill all required fields"
This is the code that works in local host but not in a live server <?php require_once 'messages.php'; ?>
Here is my full code
Register page: <html> <?php require_once 'messages.php'; ?> <br><br> <form action="register-clicked.php" method="POST"> Username:<br> <input type="text" name="usernamebox" placeholder="Enter Username Here"> <br><br> Email:<br> <input type="text" name="emailbox" placeholder="Enter email here"> <br><br> Password:<br> <input type="password" name="passwordbox" placeholder="Enter password here"> <br><br> Confirm Password:<br> <input type="password" name="passwordconfirmbox" placeholder="Re-enter password here"> <br><br> <input type="submit" name="submitbox" value="Press to submit"> <br><br> </form> </html>
Register clicked <?php session_start(); $data = $_POST; if( empty($data['usernamebox']) || empty($data['emailbox']) || empty($data['passwordbox']) || empty($data['passwordconfirmbox'])) { $_SESSION['messages'][] = 'Please fill all required fields'; header('Location: register.php'); exit; } if ($data['passwordbox'] !== $data['passwordconfirmbox']) { $_SESSION['messages'][] = 'Passwords do not match'; header('Location: register.php'); exit; } $dsn = 'mysql:dbname=mydatabase;host=localhost'; $dbUser='myuser'; $dbPassword= 'password'; try{ $connection = new PDO($dsn, $dbUser, $dbPassword); } catch (PDOException $exception){ $_SESSION['messages'][] = 'Connection failed: ' . $exception->getMessage(); header('Location: register.php'); exit; }
messages.php <?php session_start(); if (empty($_SESSION['messages'])){ return; } $messages = $_SESSION['messages']; unset($_SESSION['messages']); ?> <ul> <?php foreach ($messages as $message): ?> <li><?php echo $message; ?></li> <?php endforeach; ?> </ul> Edited Wednesday at 12:49 AM by bee65 Hi, I am not a PHP programmer. I took on a new client with a simple PHP site, without any databases. The site is up and running on the web. I would like to get it running on my local machine for further development. I have latest version of WAMP installed, running Apache version 2.2.11 and PHP version 5.3.0 I created a directory in the WAMP "www" project directory and it shows up there like it's supposed to when I browse to "localhost" Problem: The home page of website displays text but no, images, styles, footer, header, nav links, etc. Here is the code for the home page: <? define("NAV","home"); require_once('local/local.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>TITLE</title> <meta name="keywords" content=""> <meta name="Description" content=""> <? include("common/dochead.php"); ?> </head> <body onLoad="<? include('common/preloads.php'); ?>"> <!-- ============================ main ============================= --> <div id="main-frame"><div id="main" class="noCollapse"> <? include("common/sign.php"); ?> <div id="right-frame"> <? include("common/navigation.php"); ?> <div id="content-frame"> <div id="content"> <h1>Welcome</h1> <p>This is the content area. This is the content area. This is the content area. </p> </div><!-- end content --> </div><!-- end content-frame --> </div><!-- end right-frame --> <div class="clearFloats"></div> </div><!-- end main --></div><!-- end main-frame --> <? include("common/footer.php"); ?> </body> </html> Any help would be greatly appreciated. I have spent many hours on this. Regards Hi folks, I'm curious if I can for example, save a file from my server and it will save to all other servers - obviously if they accepted the connection first. It's for a software I developed and is almost complete and know there will be frequent updates to it. Instead of users downloading upates, I want the update files from my server to somehow synchronize to their server automatically? Anything called this?? Thanks for info. Following a tutorial on udemy, i tried to learn the very basics of mvc structure. I built the same project on my local server and it worked without giving me any error. but when i tried it on live server. its not working as it should. not showing any error. I tried to figure out the problem and found that for every page loading, it stops at the same line in my main.php file. <?php require($view); ?> starting from the above line. it stops. i came here to share my problem but i am unable to upload my files here. if there is a way to upload and share my files, please guide. zip file size of the whole project is 31.6 kb This isn't exactly an application design question, but rather a system design one.
I am about to install an Inventory Control System inside this store I work in.
The store itself also owns a Linode VPS running Centos 6.4 which hosts our website.
This new Inventory System will come built in with a Microsoft SQL Server, and supposedly it is a SQL Anywhere database, but I'm not too sure what that means.
I need to make this database publicly accessible, but only via the Linode VPS. Surely, setting restrictions is easy enough to address that issue. That isn't my question.
My first idea is to put this server into the DMZ, easy. But it doesn't exactly sound safe. So my next idea was to put a middleman server in the DMZ, this way the Linode can send queries to that middleman server and it will send that data to the SQL Server and back. This is very vaguely described I know, but I don't want to get too much into details, but rather, understand how I can create that middleman server, and what could Install onto it that would allow me to securely process queries?
My first thought was to install a webservice, that accepts an XML/JSON request and returns an XML/JSON response.
Then, I realized directly afterwards that I don't have any experience setting up a webservice like that.
What kind of options are there out there? Ultimately, my question is, should I just put the Server in the DMZ or should I create the middleman, and if so, can someone point me in the right direction as to getting a webservice set up? Edited by Zane, 15 July 2014 - 11:28 PM. |