wwfc_barmy_army
-
Posts
320 -
Joined
-
Last visited
Never
Posts posted by wwfc_barmy_army
-
-
Thanks guys. byte1918's suggestion worked perfectly.
-
Hello.
I currently use this to check if they have submitted a valid domain:
preg_match ("/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i", $domain)
Works for example google.com but not for example mail.google.com.
So if there an easy way to accept subdomains too?
Thanks.
-
Hello everyone.
Basically I have this htaccess rule:
RewriteEngine On RewriteRule ^([^/]+)?/?$ index.php?do=$1 [L,QSA]
But when i go to any of the following it runs the rule
-mydomain.com/adirectory
-mydomain.com/adirectory/
But this loads like it should:
-mydomain.com/adirectory/index.php
Can i give exceptions to the rule for certain domains so for example
-mydomain.com/adirectory
goes to the subdirectory rather than following the htaccess rule?
Thanks.
-
RewriteEngine On RewriteRule ^([^/]+)?/?$ index.php?do=$1 [L,QSA]
worked. Thanks,
-
It now says:
When i try http://ictwebserv/check/test.com.
Not Found The requested URL /check/test.com was not found on this server.
Any ideas?
-
Hello.
I have this rewrite code now:
RewriteEngine On RewriteRule ^(.+)$ index.php?do=$1 RewriteRule ^(.+)/$ index.php?do=$1
The 'do' variable holds a domain name. So it would be something like:
http://mydomain.com/domain.com
So domain.com is what I am after.
It goes to index.php ok, no problems there. BUT when i try to get the 'do' variable it says it's 'index.php'.
Any ideas?
Thanks.
-
Actually, I've found some more stuff i've read up on. Would it be more along these lines:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ domaincheck.php?domain=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ domaincheck.php?domain=$1
Thanks for any advice
-
I know this isn't PHP, but would it be something like:
RewriteRule ^/$ /domaincheck.php?domain=$1
Something along those lines? I've never played with htaccess before as you can probably tell lol.
-
Hello.
I'm not sure how to go about this but I am wondering how to use a peice of info (a domain) from the address bar. To explain I will use the example of domaintools.com.
When you put an address into the text box (in this example google.com) and click submit the address turns to:
http://whois.domaintools.com/google.com
I am just wondering how you are able to a) load the page even with that domain at the end b) Get that domain as a variable to use from the domain.
Thanks for any advice/code.
(P.s. I am not creating a whois site lol)
-
I seriously doubt you'll be able to find a good one, much less a free good one. (Well, you never said free, but just assuming.)
Wouldn't mind if it was paid within reason. Any suggestions would be welcomed. Thanks.
-
Anyone know where i might be able to find a UK car database list, presumably similar to what people like autotrader.co.uk use?
Not sure which section this belonged in.
Thanks.
-
It's in plain text rather than a textbox unfortunately else it would be easy enough but I don't know how to get it from plain text. Anyone?
-
Hello.
I'm using this as fuctions for a web scrape:
http://sourceforge.net/projects/simplehtmldom/
I've figured out everything else but i just have one last thing i'm having trouble with; using $html->plaintext allows me to output all text on the webpage. Although i am looking just to get a certain line;
The source page has a line like the following:
Password: apassword
this is shown in the $html->plaintext output but seems to be all on one line from what i can tell.
So my question, how can i just get the line that starts with "Password: "?
Thanks for any help/advice/code.
-
Crayon Violent:
Ok Crayon Violent, i'll check over my variables.
P.s. shlumph posted that last post not me.
shlumph:
They are archive passwords, not account passwords or anything.
-
What info do you need to know Crayon Violent ?
Thanks.
-
Hello.
I've tried:
$outputtext = $html->plaintext; preg_match('~^Password:.*~',$outputtext,$match); //print_r($match); //echo $match; foreach ($match as $value) { echo $value; }
But it doesn't return anything. Any ideas?
Thanks.
-
Hello.
I'm working on a scraping script and I just need to get this last thing; I need to get the line of text that starts with "Password:".
Can i use this bit of code:
// extract text from HTML echo $html->plaintext;
And use some kind of if statement after? Or is there a better way?
Thanks for any advice/code
-
preg_match is used for regular expressions. If you want to learn more about it, I suggest you just google "create regular expression"
However, instead of looking for a regular expression, you should be able to use strpos, and it should fix your little problem.
$site = 'http://mysite.com'; foreach($html->find('a') as $e) { if ( strpos($e->href, $site) == true ) { echo $e->href . '<br>'; } }
Thanks it worked. Couldn't get it to work with 'http://mydomain.com' had to just use 'mydomain.com' any reason for this?
Thanks.
-
Is there somewhere that explains how to build a preg_match? Is there an if statement i can use for that, eg:
foreach($html->find('a') as $e)
if(Starts with http://mydomain){
echo $e->href . '<br>';
}
-
Hello.
I'm trying some PHP scraping, as i've never done anything like this before and i'm still reasonably new to php.
I've got it so it can display all links using this code:
foreach($html->find('a') as $e) echo $e->href . '<br>';
I want it so it only shows links to a certain domain. Eg. only show links to http://mydomain.com or http://www.mydomain.com.
any ideas how i could do this? Some kind of preg match? ???
Thanks.
-
Thanks
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(count = count +1, reasons = 'ftugsdt
- dasfdsfsd') WHERE username = 'TUSER' at line 1
and if i take the new line out of $newreason:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(count = count +1, reasons = 'ftugsdt - sdfgds') WHERE username = 'TUSER'' at line 1Any ideas?
Thanks.
-
Hello. I can't figure out what is wrong with my SQL code, but it keeps failing
$query = "UPDATE previous SET (count = count +1, reasons = $newreason) WHERE username = '$username'"; echo $query; mysql_query($query) or die('Error, query failed');
Currently outputting:
UPDATE previous SET (count = count +1, reasons = ftugsdt- sdfgd) WHERE username = 'TUSER' Error, query failed
Thanks for any help.
-
For some reason it's looking at a different php.ini. If anyone knows how to change what php.exe looks at it'd be great. Thanks.
[SOLVED] Stripping subdomain from url
in PHP Coding Help
Posted
Hello.
I have a form for where a domain is submitted. Although i only need the base domain so no subdomains.
I'm guessing it will be some kind of str_replace or preg_match but i'm unsure what it would be.
So if for example mail.google.com was submitted the value i want is google.com, and if google.com is submitted i want google.com.
Thanks for any advice/code.