|
Posted by Rik on 01/13/07 16:58
diego.sala@gmail.com wrote:
> If you go to http://europe.nokia.com/A4305060, fill the "Enter your
> product code:" field with the value "0523183" and press "Go" (the
> ending page URL varies because there's a variable session-ID in the
> URL-link associated to "Go") you will obtain this string:
>
> "Version: RM43_V1.10.030"
>
> Is it possible to have a string.php page that just display this
> string? how can I do it?
It would help if you could determine what actually happens when posting the
form. It relies on javascript, which is not available to you directly in
PHP. If you know a little bit of javascript and have some time, you might
figure out exactly what's done on a submit of the form, and mimique that
with for instance cURL.
If it's directly written to the page, you could use a regex on the obtained
$html to capture the version:
preg_match('|<div
id="phoneUpdateQueryResults">.*?<dd><span>(.*)</span>|si',$html,$match);
echo "Version is {$match[1]}.";
I'd say it is a LOT of work to figure out how to bypass/replicate the
javascript. Maybe it's easier to ask Nokia wether they have some more
direct/transparant link you can use.
I've cheated a bit: I have used Fiddler to examine the request, and I've
taken as much out as i could to still make it work. Using cURL to get the
data seems to work here now, but as I'm not familiar with the Nokia
backend, I cannot be sure about the validity of the different values, they
can be temporary, expiring, are altered without notification offcourse :-).
<?php
$id = '0523183';
$post =
'T42560468101167294708450l10n=%2Fncom4%2FGB%2FSoftwareVersion%2F%2Flabels.s
tr%3B%2Fncom4%2FGB%2FSoftwareVersion%2F%2Ferrors.str%3B%3B%3B&T425604681011
67294708450%7BactionForm.productCode%7D='.$id;
$url =
'http://europe.nokia.com/appmanager/UnitedStatesEnglishEUROPE_NOKIA_COM_3/G
et_support?_nfpb=true&_windowLabel=T42560468101167294708450&_pageLabel=P324
575&wsrp-urlType=blockingAction&wsrp-interactionState=_action%3D%2Fpageflow
s%2FSoftwareVersion%2FgetVersion';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($ch);
preg_match('|<div
id="phoneUpdateQueryResults">.*?<dd><span>(.*)</span></dd>|si',$html,$match
);
echo "Version is {$match[1]}.";
?>
Mind you: the $post & $url values should be on one line, remove the
newlines envitabel created in posting to a newsgroup.
--
Rik Wasmus
[Back to original message]
|