Fix in php5 class and one question

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

Hi,
after testing for several hours, I found a bug in the php5 class.

Replace:

$defaults["u"] = self::SECRET_KEY;
$args["Url"] = $url;
foreach ($defaults as $k=>$v)
 if (!isset($args[$k]))
$args[$k] = $v;
$request_url = urldecode("http://www.shrinktheweb.com/xino.php?".http_build_query($args));

with:


$defaults["u"] = self::SECRET_KEY;
// $args["Url"] = $url; this should be moved down
foreach ($defaults as $k=>$v)
 if (!isset($args[$k]))
$args[$k] = $v;
$args["Url"] = $url;   // now url is last
$request_url = urldecode("http://www.shrinktheweb.com/xino.php?".http_build_query($args));

Moving the urlarg so it's placed last in the query.

I also have a question:
could someone help me with a regex to get the statuscode in php?
I guess it should be a modification/alternation to the following code, since it picks up the url.

        $regex = '/<[^:]*:Thumbnail\\s*(?:Exists=\"((?:true)|(?:false))\")?[^>]*>([^<]*)<\//';

        if (preg_match($regex, $line, $matches) == 1 && $matches[1] == "true") {
		return $matches[2];}


Could someone help me rewrite that pice of code to extract the line inside <stw:StatusCode>XXXX</stw:StatusCode>.

Also to STW staff: Is there a list of statuscodes avalible?

Jimmy

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Hello Jimmy,

JimmyHolm wrote:
after testing for several hours, I found a bug in the php5 class.

Moving the urlarg so it's placed last in the query.

Thanks for pointing that out. We updated one of the blocks on Jan 30th, but missed the other one. Since this code was written by someone else in the community, it is very helpful when others pinpoint issues like this. So, thank you. Smile

Devis :
I also have a question:
could someone help me with a regex to get the statuscode in php?
I guess it should be a modification/alternation to the following code, since it picks up the url.

$regex = '/<[^:]*:Thumbnail\\s*(?:Exists=\"((?:true)Angry?:false))\")?[^>]*>([^<]*)<\//';

if (preg_match($regex, $line, $matches) == 1 && $matches[1] == "true") {
return $matches[2];}

Could someone help me rewrite that pice of code to extract the line inside XXXX.

Yes, but due to our migration, we are a few days behind on support requests. So, we are in catch up mode. However, I will put the question out to see how others have been doing it. Perhaps they already figured out the best method.

Devis :
Also to STW staff: Is there a list of statuscodes avalible?

Yes, but it isn't a formal listing. We have been swamped with growth and trying to keep up with demand, so we're behind on documentation. However, we have a list in text format that I will have sent to you shortly.

Best regards,

Brandon

JimmyHolm
Offline
Joined: 02/08/2009
Visit JimmyHolm's Website

Hope to see the statuscode list later,
Im planning on using my own "nothumb" images and need to adress the right codes.

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website
JimmyHolm wrote:
Hope to see the statuscode list later,
Im planning on using my own "nothumb" images and need to adress the right codes.

Sure, I'll get that list sent to you today or tomorrow.

In the meantime, you may want to look at the PHP4 code also. I wrote code in there (not using a regex) that automatically shows the "Thumbnail Queued" when there is no thumbnail. However, if you want to get very specific with status codes, then you probably want to wait on the list.

-Brandon

puravida's picture
puravida
Jedi Warrior
Offline
Joined: 09/01/2007
Visit puravida's Website

Hi Jimmy,

Sorry for the delay. I found that informal listing of responses. I apologize if it might end up being out of date, as it was written up in Oct of last year.

Pagepix Documentation

I hope to have these updated and back to me by late March. That's the goal anyway. Documentation is key, but extreme growth with our service has pushed it way behind.

We also provide schema validation for our XML responses. If you might find that helpful, it is located at: stwresponse.xsd

Best regards,

Brandon

Topic locked

ShrinkTheWeb® (About STW) is another innovation by Neosys Consulting

Contact Us | PagePix Benefits | Learn More | Our Partners | Privacy Policy | Terms of Use

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