Php link exporter
Moderator: General Moderators
Re: Php link exporter
Can anyone please help me?? :/
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
Hi The_L
Glad you got it working, and sorry I missed your email, only just spotted it!
Not too sure what you mean by the last bit? If your code is picking up the URLs then it should be picking up URLs wherever they appear. Could you give a specific example of a URL it doesn't pick up?
Glad you got it working, and sorry I missed your email, only just spotted it!
Not too sure what you mean by the last bit? If your code is picking up the URLs then it should be picking up URLs wherever they appear. Could you give a specific example of a URL it doesn't pick up?
Re: Php link exporter
Okay here:
This is the one with this code:
And this one is the one with this code:
This is the link from the source code of the page:
I hope it helps....
This is the one with this code:
Code: Select all
$stag="<a href=\"http://rapidshare.com";
$etag="\" class=\"bbc_link new_win\" target=\"_blank\">";Code: Select all
$stag="<a href=\"http://rapidshare.com";
$etag="</a><br />";
And this is the page witch i used for testing...<a href="http://rapidshare.com/files/177751587/9 ... 2.rar.html" class="bbc_link new_win" target="_blank">9Dragons 2. deo</a><br />
I hope it helps....
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
Can't quite see what your example pages are supposed to be doing, but it doesn't matter.
The problem is going to be somewhere in your pattern matching code (the bit that uses $stag and $etag). Copy and paste the bit that uses those two variables to find a match please?
I'd still strongly recommend you use the regex instead of the method you're attempting to use, as the regex should catch this URL easily.
The problem is going to be somewhere in your pattern matching code (the bit that uses $stag and $etag). Copy and paste the bit that uses those two variables to find a match please?
I'd still strongly recommend you use the regex instead of the method you're attempting to use, as the regex should catch this URL easily.
Re: Php link exporter
I would use regex but i don't know how to use it and where to get one...:/
Can you be more specific?? "bit"???? :/Copy and paste the bit that uses those two variables to find a match please?
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
please read my posts carefully, I've given you the regex (which admittedly doesn't seem to work when copied and pasted on the forum), but I've also told you specifically where in the status.net source code you can find exactly the regex you need. I've also given you step by step instructions on how to integrate that regex with your code and how to use it to find URLs in source HTML.iankent wrote:check the status.net source code yourself. you can get it at http://www.status.net/. the file you need is util.php. copy and paste the $regex line from there yourself - its easy to spot, its the only regex that big
I don't mind helping but there's no point in me repeating myself over and over, so please, read through this topic carefully and if you still can't get it to work, please provide the full code you're trying to use.
Re: Php link exporter
i followed all your instructions and still cant make it work...its just too confusing...
And here are the codes...:/
And here are the codes...:/
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
Have a look at the attachment.
Couple of points to note:
1. It does return some false positives. It should be simple to filter these out should you need to.
2. I've commented out your CURL code and used file_get_contents (my dev server doesn't curl installed atm)
3. I've put both the class and the main code in the same file for testing
3. I've removed the $stag and $etag variables
4. The parse_array function in your class doesn't have any parameters.
5. Matching is done only using the regex, avoiding the need to manually search the HTML for any occurances of a string
edit: there's a bug on line 23, the second <li> should be </li>
hopefully that'll give you a good starting point!
1. It does return some false positives. It should be simple to filter these out should you need to.
2. I've commented out your CURL code and used file_get_contents (my dev server doesn't curl installed atm)
3. I've put both the class and the main code in the same file for testing
3. I've removed the $stag and $etag variables
4. The parse_array function in your class doesn't have any parameters.
5. Matching is done only using the regex, avoiding the need to manually search the HTML for any occurances of a string
edit: there's a bug on line 23, the second <li> should be </li>
hopefully that'll give you a good starting point!
Re: Php link exporter
Damn...i didnt understund anything xD ... So what to change/add/remove???
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
if you download the example and run that PHP file, it should do pretty much what you wanted. it'll scan the result of http://www.google.co.uk/?q=test for any URLs it can find, outputting them on the page.The_L wrote:Damn...i didnt understund anything xD ... So what to change/add/remove???
Re: Php link exporter
All i see is errors...:/
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
Care to share what they are? It works ok for me so seeing the errors would helpThe_L wrote:All i see is errors...:/
Re: Php link exporter
Can you upload your files?
Current errors is...
Current errors is...
Fatal error: Using $this when not in object context in /nfs/c02/h10/mnt/30579/domains/forum-racunara.com/html/test/taggrab.class.php on line 46
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Php link exporter
I already have, it was an attachment to an earlier post. I did make that clear in two separate posts.The_L wrote:Can you upload your files?
If you use the code in my attachment then the error you've had is impossible.
If you're using the code you uploaded (http://forum-racunara.com/test/link grabber.rar) then taggrab.class.php no longer contains a class declaration, so the $this variable doesn't exist in the context of parse_array().
Re: Php link exporter
I'm trying to make your script to work...can you just make it work and attach it? it would be so much easier than this argue...i know i'm asking much but it would end all this...