logs archiveIRC Archive / Freenode / #php / 2015 / November / 14 / 1
rc0r
hi
are pecl extension in general compatible with php 5.6.* and php 7.*?
And do I have to expect builds from git master to fail from time to time?
user12358
clear
manrig
Hi guys Im customizing an email sent out by Create Customer WooCommerce plugin to look like my template emails - I have a problem with the shortcodes displaying in Email as they normally do - Here is my shortcodes classes- Can someone advise how to register the script ( http://pastebin.com/MmkxcQSV ,, http://pastebin.com/Ee6CcuuT ------ Email Customizer ,,,,,,,,,,, SEE LINE 568 here
http://pastebin.com/PmreVpGG --- I have used a function in my functions.php to renavigate the wc_get_template directory. is there a way I can get server to send email without specifying everything?
Alphos
manrig we don't support wordpress or woocommerce. ask in #wordpress
azy
hey could someone help me turn a curl command into php code? curl "https://opskins.com/ajax/search_scroll.php" -H "Host: opskins.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0" -H "Accept: */*" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "X-Requested-With: XMLHttpRequest" -H "Referer: https://opskins.com/index.php?loc=shop_search&search_i
tem=AK-47+"%"7C+Cartel+"%"28Minimal+Wear"%"29&min=&max=&inline=&grade=&inline=&type=&inline=&sort=lh" -H "Connection: keep-alive" -H "Pragma: no-cache" -H "Cache-Control: no-cache" --data "type=scroll&page=2&data="%"7B"%"22search_item"%"22"%"3A"%"22AK+47+++Cartel++Minimal+Wear"%"22"%"2C"%"22StatTrak"%"22"%"3A0"%"2C"%"22grade"%"22"%"3A"%"22"%"22"%"2C"%"22type"%"22"%"3A"%"22"%"22"%"2C"%"22sort"%"22"%"3A"%"22lh"%"22"%"2C"%"22min"%"22"%"3A"%"22"%"22"%"2C"%"22max"%
"22"%"3A"%"22"%"22"%"2C"%"22vanilla"%"22"%"3Afalse"%"7D"
https://paste.debian.net/hidden/9508e57d/
oq
azy
i cut the basic stuff out, i have error checking and i specify the url etc
i get a cloudfare error because of malformed data
or something isn't identical to the curl command
i
tem=AK-47+"%"7C+Cartel+"%"28Minimal+Wear"%"29
AK-47 | Cartel (Minimal Wear)
it formats it differently in the referrer and in the post, and i think thats where i mess up
Woet
azy: so show your code
azy: also, https://opskins.com/tos.html - "systematically retrieve data or other content from the Service to create or compile, directly or indirectly, in single or multiple downloads, a collection, compilation, database, directory or the like, whether by manual methods, through the use of bots, crawlers, or spiders, or otherwise"
azy: so don't do that.
azy
yeah i promise i wont. it's for learning purposes only
https://paste.debian.net/hidden/1d1a22cd/
         

Woet
i see
Puck`
if I have an array that is setup like $files[$x]["filename"] = $filename and $files[$x]["date"] = filemtime($filename), $x++, why doesn't foreach($files as $file) work? When I try to loop through the array I only get one array element. What am I doing wrong?
here's the code: http://pastebin.puck.in/view/b61e0531
biberu
Puck`: your $x is constant
Puck`
you're right, damn
that was the trick, heh, thank you
can I rearrange the array based on the date?
biberu
sort it you mean? www.php.net/usort
Puck`
yes, thank you
biberu: is it the 2nd example that should help me because I have multi-dimensional array?
biberu
Puck`: yes, $a and $b are items in your array and are selected by the sort function, you need to pass it a callback that can compare them (answer if $a["date"] <=> $b["date"])
Puck`
biberu: I used the multiSort example in the comments, works great
biberu
but unneccessary
usort($files, function($a, $b) { return $a["date"] - $b["date"]; });
Puck`
I did $files = usort($files, function($a, $b) { return $a["date"] - $b["date"]; });, now the foreach loop doesn't work, I seem to be missing something, what do I need to read up on?
biberu
you need to verify what usort returns :)
NiLon
it also helps to read the error messages
and then var_dump() is your friend
Puck`
thank you guys
z3l
Hello.
How can I with preg_match retrieve `/page/one/.*?` in this http://pastie.org/10556482 ?
Woet
z3l: what have you tried so far?
z3l: why are you parsing HTML with regex rather than DOM?
z3l
Woet: Wouldn't it be faster ?
to parse it with regex
Woet
z3l: i'm not sure, isn't it more important to use the right tool?
z3l
Woet: Haven't known about DOMXPath , thank you.
RedBelette
Hi all, do you think that my pdo query is correct ?
http://pastebin.com/k9pmhe6S
Woet
RedBelette: why are you asking?
         

RedBelette
Woet it's my first contact with pdo and perhaps do you have some advice ?
NiLon
try it
RedBelette
this code work correctly
biberu
RedBelette: read this out loud: select * from users where email = :username
NiLon
so you wanna know what is wrong with it?
1) inconsistent naming: using email as username 2) select *: unnecessary payload and weak debugging 3) you fetch the password instead of matching it inside the database
3 again causing unnecessary payload
and maybe 4) using $_POST without checking if it exists first
biberu
or if it's even a string and compatible with the expected encoding
NiLon
all post values are strings tho
biberu
no
and he's just putting the emails/passwords in a map, not matching anything, but even if he were that shouldn't be done in the database (being able to plainly select by it should never work)
NiLon
the matching was educated guess given that there is very little reason to fetch password otherwise
and database is called "authenticatetable"
RedBelette
thanks for yours responses
NiLon i replace the real table name by authenticatetable just to dont show private data (it's not important i think)
NiLon
it's not table name but database name
RedBelette
oh, yes, my bad
webdev232424
Hey. If i run curl from a file, will my server be held up by others using the same script it is ran from?
zap0
grammar, do you speak it?
webdev232424
Hey. If i run curl from a php file, will my server be held up by others using the same php file it is ran from?
i guess not. curl isn't blocking is it?
zap0
i think you're asking if your http server can run multiple instances of that php script. yes it can.
webdev232424
zap0: ok. And just because im running an external program(curl) that won't mean anything gets held up? curl too can spawn multiple processes i suppose?
NiLon
if you call it thru exec then by default it will block
it's not obvious how you are using it so "maybe"
webdev232424
NiLon: like this: $ch = curl_init($arr2[':url']);
NiLon
then it will block
webdev232424
oh sh*t
how do i call it another way?
NiLon
or init doesn't block to be accurate
but exec will
webdev232424
hmm.
ok.
NiLon
there might be an option to make it nonblocking and get data from callback instead
check http://php.net/manual/en/function.curl-setopt.php
there is some stuff around that in the bottom at least
another thing is that do you really need non-blocking curl
job server like gearman might be what you are after instead
webdev232424
NiLon: hmm. i dont think a jobserver would help things. the user is waiting while the curl script runs and he should wait the shortest time possible.
NiLon
if it's background job then no reason to make him wait
webdev232424
so i think i need non-blokcing curl
NiLon
just push it to job server and say goodnight
with non-blocking curl user still needs to wait
so it's not really a solution
webdev232424
NiLon: yes it is
1 2 3 4 5 next »