Fieldtype

Archived
Forum
(read-only)

JCO URL

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Jerome Coupe

     

URL Not Found with valid website

Support Request

JonnyT
JonnyT

Love this plugin! Exactly what I’m after!

I’m entering URL’s that I know exist but still getting the URL not found error. I’m using EE 2.4.

Do you have an idea of what could cause it? Or something I’ve not done?

Thanks,

Kragit
# 1
Kragit

Having the issue as well on EE 2.4 & 2.5. Happens to some Wikipedia entries.

Jérôme Coupé
# 2
Developer
Jérôme Coupé

Sorry, I don’t get alerts sometimes from here (Thanks for pinging me via email, Adam)

Could you guys give me an example of an URL that does not work for you and one that does? I’ll try to look into it ASAP. Probably a problem in the headers that it sends back, parsing those (especially if there are redirects can be tricky.

Kragit
# 3
Kragit

This one for sure:

http://www.sho.com/sho/movies/titles/103932/run-the-wild-fields#/index
(if you try to access it from /run-the-wild-fields, it’ll add the #/index at the end, but even if you paste it in like above, it still doesn’t validate).

Wikipedia ones seem to be flaky. They’ll work sometimes (I’ll be able to save the entry) but then sometimes, when I’m going back and editing the entry sometime later and submit, it brings up error with the URL. Not quite sure what’s going on there.

Jérôme Coupé
# 4
Developer
Jérôme Coupé

Strange, just tested it on local install (2.5 and MAMP) and it validates just fine on my end.

http://www.sho.com/sho/movies/titles/103932/run-the-wild-fields#/index

headers returned

Array ( [0] => HTTP/1.0 200 OK [Server] => Apache [Content-Language] => en-US [Content-Type] => text/html;charset=ISO-8859-1 [Date] => Thu, 24 May 2012 15:27:18 GMT [Content-Length] => 22155 [Connection] => close )

Kragit
# 5
Kragit

Not sure, definatley gives me the ‘Error: URL not found’ error.

Running on Debian 6, PHP 5.3.3-7.

It wouldn’t *seem* like it would be other fieldtypes/plugins, as it works fine for most URLs… Not sure how else to explain the above url and the occasional Wikipedia URL issues.


EDIT: Well, this is interesting. It seems to validate fine on my local copy. OS X, PHP 5.3.10

Jérôme Coupé
# 6
Developer
Jérôme Coupé

Well,

Interesting indeed. Could you please add the following lines after line 140 of the fieldtype

So

$http_code preg_match('/^HTTP\/\d\.\d\s+(200|301|302)/'$header); 

becomes

$http_code preg_match('/^HTTP\/\d\.\d\s+(200|301|302)/'$header);
$this->EE->load->library('logger');
$this->EE->logger->developer($header); 

Try to validate the URL again on the box that returns an error and check out what it says in the developer log. You should see the response code returned by the headers (if any)

EDIT: going home now, will check here again in a couple of hours

Kragit
# 7
Kragit
HTTP/1.1 200 OK 
HTTP
/1.0 500 Internal Server Error 

Pretty sure the 200 OK is the control panel refreshing, so it seems that when JCO URL checks the submitted link, it’s returning a 500.

I do believe I have a PHP and cURL update for the Debian server, but I’m holding off on that. Let me know if you’d like me to run them.

Jérôme Coupé
# 8
Developer
Jérôme Coupé

First header is not the CP refreshing IMHO, and I am using get_headers(), not cURL. Would be interesting to try a raw debug on that box. Something along the lines of:

$url 'http://www.example.com';
print_r(get_headers($url1));
exit; 

Replace with the URL you used. Very quick and dirty, so don’t use it on prod ;o) Just to see if that’s the function that is problematic. Not a programmer by trade but I think that could be the problem. Off now, will be back tomorrow. Will hit you on twitter or skype

Also, don’t forget to remove / comment out those two lines I made you add there, or your logs will get clogged pretty quickly ;o)

Kragit
# 9
Kragit
<?php
$url 
'http://www.sho.com/sho/movies/titles/103932/run-the-wild-fields#/index';
print_r(get_headers($url1));
exit; 
?> 

Returns:

Array ( [0] => HTTP/1.0 500 Internal Server Error [Server] => Apache [Content-Language] => en-US [Content-Type] => text/html;charset=ISO-8859-1 [Date] => Thu24 May 2012 17:26:53 GMT [Connection] => close 
Jérôme Coupé
# 10
Developer
Jérôme Coupé

Well, I suppose the same script returns a code 200 on your other box ...

That’s very strange, when I test that URL online, I found a service giving me a code 500, while all the others have given me a code 200. IMHO, your problem has got nothing to do with the add-on but either with the box or with the URl itself. Not being a Debian geek or anything remotely resembling a sysadmin or a network expert, I am afraid there is not much I can do for you with that issue.

To give you a solution, one thing you can do is try out VZ URL Extension by Eli Van Zoeren and see what the results are with that one (I’d be interested to know). That extension is much more advanced bu does not prevent people from submitting the entry (which is why I developed mine for a specific project).