Trouble with appSTW class

Update: The content in this post maybe out of date or inaccurate. Visit our Support Page

Hi I am using STW Admin and am planning on upgrading to a premium subscription. I am using symfony and having a very difficult time getting the images to show. I can get image to display using the

I create a separate directory for the image called static and then the folders images/thumbnails. I downloaded AppSTW class and saved it in the appropriate location. I the following code and get nothing. There is no cached image in my directory either. Do you have any advice?

 
<?php echo image_tag(AppSTW::getThumbnail('espn.com', true, true)); ?> 

Thanks,

Russ

Imagen de puravida
puravida
Jedi Warrior
Desconectado
Integró: 09/01/2007
Visitar puravida's Sitio web

Hi Russ,

In case you did not yet receive our email reply, here is my earlier response:

My first thought is: "Did you include the the AppSTW class file?"

In other words:

<?php
include("/path/to/AppSTW");
echo image_tag(AppSTW::getThumbnail('espn.com', true, true)); 
?>

Best regards,

Brandon

Russpd
Desconectado
Integró: 02/12/2009
Visitar Russpd's Sitio web

Hey brandon,

Thanks for corresponding with me via email. I figure that for the sake of the forum and for other people with the same issues it might be helpful to transfer your advice to the forum. Feel free to respond here, there is no need to send me an individual email.

To recap, I am able to get images perfeclty using the simpler method to retrieve thumbnails.
Simple method: works perfectly.

<img src="http://www.shrinktheweb.com/xino.php?embed=1&stwu=[secret]&STWAccessKeyId=[key]&Size=lg&stwUrl=espn.com" border="0" alt="A preview image">   

However, using the same URL I have trouble retrieving cached images and get an error shown belo.

<?php echo myTools::queryRemoteThumbnail('espn.com', true, true); ?>

Returns this:

Array
(
    [Service] => ShrinkWebUrlThumbnail

    [Action] => Thumbnail
    [Url] => espn.com
)

<?xml version="1.0" encoding="UTF-8"?> 
<stw:ThumbnailResponse xmlns:stw="http://www.shrinktheweb.com/doc/stwresponse.xsd">
    <stw:Response>
        <stw:ThumbnailResult>
            <stw:Thumbnail Exists="false"></stw:Thumbnail>
            <stw:Thumbnail Verified="false">noretry</stw:Thumbnail>
        </stw:ThumbnailResult>
        <stw:SiteInfo>
            <stw:Title><![CDATA[]]></stw:Title>
            <stw:Description><![CDATA[]]></stw:Description>
        </stw:SiteInfo>
        <stw:ResponseStatus>
            <stw:StatusCode>Invalid Request: Improperly formatted Url</stw:StatusCode>
        </stw:ResponseStatus>
        <stw:ResponseTimestamp>
            <stw:StatusCode></stw:StatusCode>
        </stw:ResponseTimestamp>
        <stw:ResponseCode>
            <stw:StatusCode></stw:StatusCode>
        </stw:ResponseCode>
        <stw:CategoryCode>
            <stw:StatusCode></stw:StatusCode>
        </stw:CategoryCode>
    </stw:Response>
</stw:ThumbnailResponse>
Imagen de puravida
puravida
Jedi Warrior
Desconectado
Integró: 09/01/2007
Visitar puravida's Sitio web

Sure, good idea.

So the post you made just before this one was your first email, and my previous post was in response to that.

Then, you replied with:

Cotización:
Thanks so much for the quick reply. I am having trouble including the file for some reason (symfony doesn't make it easy to use the include() function. However if I stick a random method in the class like
public static function foo() {
echo 'bar'
}

and then echo the result from the file that I want, I see 'bar'

This shoudl mean that the file and its methods are getting included right?

To which I replied:

Cotización:
That would seem to be the case, but I am not familiar with symfony. So, I cannot say with any authority.

Perhaps it would be easier to just copy/paste the class/functions from our sample file into symfony directly? Might that work?

So now, I'm wondering if that is a possibility and if it makes any difference...

-Brandon

Russpd
Desconectado
Integró: 02/12/2009
Visitar Russpd's Sitio web

Hi Brandon,

Not sure if that is the problem. The files are definitely included within symfony the right way. I tried playing around with this a bit today and didn't have any luck.

Is there any way we can see why it is returning an invalid URL?

Thanks so much for the help!

Imagen de puravida
puravida
Jedi Warrior
Desconectado
Integró: 09/01/2007
Visitar puravida's Sitio web

Hi Russ,

Our request logs show that your request for this instance looks like:

http:\espn.com

So, it looks like symfony is prepending this bad data. I assume symfony only because I have never seen our code prepend http:\ and because we have had no reported issues with supplying &stwUrl=domain.tld (e.g. without the http:// part).

To see if symfony is somehow trying to reformat, try to send us your request with the http portion. So the end of your request will look like:

&stwUrl=http://espn.com

-Brandon

p.s. also verify that the data you are sending is really stored as espn.com and not http:\espn.com

Russpd
Desconectado
Integró: 02/12/2009
Visitar Russpd's Sitio web

Hmm interesting brandon. Good catch there. Unfortunately, I am not sure that this is the problem.

The following code works with espn.com or with http://espn.com

<img src="http://www.shrinktheweb.com/xino.php?embed=1&stwu=5729b&STWAccessKeyId=XXX&Size=lg&stwUrl=espn.com" border="0" alt="A preview image">	 

I tried substituting http://espn.com for espn.com but no dice in the following code.

<?php echo myTools::queryRemoteThumbnail('http://www.espn.com', true, true); ?>
Imagen de puravida
puravida
Jedi Warrior
Desconectado
Integró: 09/01/2007
Visitar puravida's Sitio web

Hi Russ,

It still appears to be a symfony problem with the URL that is getting passed.

I have added some code to instantly detect that specific bad data being passed and will show the original request in the responsecode's statuscode (in the XML response).

Try your request again and post here the response again.

Thanks,

Brandon

p.s. if it shows http:\espn.com, then you will need to contact symfony support and ask why they are putting the literal char ( \ ) before that var/domain.

Russpd
Desconectado
Integró: 02/12/2009
Visitar Russpd's Sitio web

Thanks for all the help Brandon. I tried the code a few more times and still got the error. Are they prepending the http://espn.com with http:/ or do they just prepend it when there is no http in front of the domain.

Thanks,

Russ

Forgot to add...

Array
(
    [Service] => ShrinkWebUrlThumbnail
    [Action] => Thumbnail
    [Url] => http://espn.go.com/
)

<?xml version="1.0" encoding="UTF-8"?> 
<stw:ThumbnailResponse xmlns:stw="http://www.shrinktheweb.com/doc/stwresponse.xsd">
    <stw:Response>
        <stw:ThumbnailResult>
            <stw:Thumbnail Exists="false"></stw:Thumbnail>
            <stw:Thumbnail Verified="false">noretry</stw:Thumbnail>
        </stw:ThumbnailResult>
        <stw:SiteInfo>
            <stw:Title><![CDATA[]]></stw:Title>
            <stw:Description><![CDATA[]]></stw:Description>
        </stw:SiteInfo>
        <stw:ResponseStatus>
            <stw:StatusCode>Invalid Request: Improperly formatted Url</stw:StatusCode>
        </stw:ResponseStatus>
        <stw:ResponseTimestamp>
            <stw:StatusCode></stw:StatusCode>
        </stw:ResponseTimestamp>
        <stw:ResponseCode>
            <stw:StatusCode></stw:StatusCode>
        </stw:ResponseCode>
        <stw:CategoryCode>
            <stw:StatusCode></stw:StatusCode>
        </stw:CategoryCode>
    </stw:Response>
</stw:ThumbnailResponse>
Imagen de puravida
puravida
Jedi Warrior
Desconectado
Integró: 09/01/2007
Visitar puravida's Sitio web
Russpd wrote:
Thanks for all the help Brandon. I tried the code a few more times and still got the error. Are they prepending the http://espn.com with http:/ or do they just prepend it when there is no http in front of the domain.

That's what we don't know. I asked to post the response here this time, because the new code I added will show us the request you are sending as-is with no modification.

That way, we will know if you are sending bad data (and whether http:// has any affect on that data) OR if it is our side that is manipulating it incorrectly.

Please run it again, grab the XML response and post it here.

Thanks,

Brandon

Russpd
Desconectado
Integró: 02/12/2009
Visitar Russpd's Sitio web

Great, sorry if this is a dumb question but how do I get the xml response? I thought my last post included it?

Topic locked

ShrinkTheWeb® (Sobre STW) es otra innovación de Neosys Consulting

Contáctenos | PagePix Benefits | Learn More | Nuestros socios | Política de privacidad | Términos de uso

©2014 ShrinkTheWeb. All rights reserved. ShrinkTheWeb is a registered trademark of ShrinkTheWeb.