473,471 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP script that displays another page partial content

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?

Jan 13 '07 #1
4 3049
Rik
di********@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%2FSoft wareVersion%2F%2Flabels.s
tr%3B%2Fncom4%2FGB%2FSoftwareVersion%2F%2Ferrors.s tr%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=T42560468101167 294708450&_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

Jan 13 '07 #2
Rik, thank you very much for your code.
I tried it, after having adjusted the the $post and $url values in one
line, but all I see at the end is "Version is .".

I'm not sure about what the script does but note that the url alone
doesn't work if I try it in Internet Explorer:
http://europe.nokia.com/appmanager/U...n%2FgetVersion

Any idea about what's the problem?

Jan 13 '07 #3
Rik
lu*******@cashette.com wrote:
Rik, thank you very much for your code.
I tried it, after having adjusted the the $post and $url values in one
line, but all I see at the end is "Version is .".

I'm not sure about what the script does but note that the url alone
doesn't work if I try it in Internet Explorer:
http://europe.nokia.com/appmanager/U...n%2FgetVersion
>
Any idea about what's the problem?
The url alone will not work, it's a form post, that's the reason to user
cURL.

Indeed the url has seemed to timed out somehow. I can take the new
poststring and url without a problem en replicate it, but I think it will
just timeout again.

Guess it either has going to be the hard way: determine what the javascript
actually does, ir the better way: contact Nokia with the question if they
have an url available which does not time out, or another service to
automatically retrieve the lastest version.
--
Rik Wasmus
Jan 13 '07 #4
Rik, thank you very much for your code.
I tried it, after having adjusted the the $post and $url values in one
line, but all I see at the end is "Version is .".

I'm not sure about what the script does but note that the url alone
doesn't work if I try it in Internet Explorer:
http://europe.nokia.com/appmanager/U...UROPE_NOKIA_CO...
Any idea about what's the problem?

Jan 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file...
3
by: Razvan | last post by:
Hello, Can somebody recommend me a Java Script scroller that can scroll an i-frame ? I tried the Tigra scroller (www.softcomplex.com/products/tigra_scroller/) but sometimes it does not...
4
by: rmccinc | last post by:
Hello- I am missing something very easy here I think. I have 3 files test.master.vb (Master) content.aspx.vb (content) Control.ascx.vb (user Control)
9
by: Yama | last post by:
Hi, How can I dynamically embed the content of a filename.js into a .aspx page before rendering it to the client? Thanks, ~yamazed
4
by: lucavilla | last post by:
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...
6
by: Boldgeek | last post by:
I am trying to develop an app that will allow automatic updating of a web form which uses multipart/form-data enctype (as it MIGHT be sending an image) I have an example form, which when...
8
by: jackrabbithanna | last post by:
I'm using a ajax script the uses a tabbed div that fetches a remote webpage to display for each tab.when clicked. the script works fine except for one thing. The content of the page i want to...
0
by: bunkle | last post by:
Okay, Here's what I want to do. I want to write a cgi-script that does something that takes a while to run. While it does that something, it displays content to a page. When it's done doing that...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
7
by: jeddiki | last post by:
Hi, As I am in Turkey at present, I can not see vidoes on youtube. So I have tried a few proxies but keep finding them slow or not working. So I have installed myphpProxy on my server under...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.