Link to home
Start Free TrialLog in
Avatar of hexo dark
hexo dark

asked on

Update : question bug php

HI

i finally got the probleme

HTTP/1.1 303 See other
Date: Fri, 02 Jan 2015 01:24:32 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.35-0+deb7u2
Location: http://website.fr//index.php
Vary: Accept-Encoding,User-Agent
Content-Length: 0
Content-Type: text/html; charset=utf-8

HTTP/1.1 200 OK
Date: Fri, 02 Jan 2015 01:24:32 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.35-0+deb7u2
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: no-cache
Pragma: no-cache
Vary: Accept-Encoding,User-Agent
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

Open in new window


The script does not receive the cookie of the line 59 - 94 and crash how to resolve the probleme ?

http://pastebin.com/R2NC4Sf3

i test with this line

 $header_size = curl_getinfo ($curl, CURLINFO_HEADER_SIZE);
    $header = substr ($html, 0, $header_size);
    print_r ($header);

Open in new window

Avatar of arnold
arnold
Flag of United States of America image

The header you posted does not have the set-cookie parameter the function for cookie setting is looking for.
Is the text you posted the some type of output from your PHP script?  Or is it the input to the script?

If it is the input, there are no cookies for your script to process.  If it is the output from your script, we would need to see the input.
Avatar of hexo dark
hexo dark

ASKER

On a forum we told me what am

It looks to me like the server isn't returning the cookie. You can read the headers thusly:
$header_size = curl_getinfo ($curl, CURLINFO_HEADER_SIZE);
$header = substr ($html, 0, $header_size);
print_r ($header);

Open in new window


résult
HTTP/1.1 303 See other
Date: Fri, 02 Jan 2015 01:24:32 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.35-0+deb7u2
Location: http://website.fr//index.php
Vary: Accept-Encoding,User-Agent
Content-Length: 0
Content-Type: text/html; charset=utf-8

HTTP/1.1 200 OK
Date: Fri, 02 Jan 2015 01:24:32 GMT
Server: Apache/2.2.22 (Debian)
X-Powered-By: PHP/5.4.35-0+deb7u2
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: no-cache
Pragma: no-cache
Vary: Accept-Encoding,User-Agent
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
                                  

Open in new window


and
There's the answer as to why it's failing - you're not getting a cookie back and your program is expecting one.

is résult of the debug
http://pastebin.com/ysAuqnQ1

I did not create the script and thus I do not know everything of the script I have to make with what I know

for the input i do not have any idea sorry
oups error is not 59 - 94 is 141 - 146
$old = $cookie;
    get(SITE_URL . $videoLink);
 var_dump($cookie, $old);
    if ($cookie == $old)
    {
        die('Impossible de récupérer les tokens de la vidéo');
    }

Open in new window

we can see that the code has an expectation that the value of cookie will have changed after the call has been made and if it doesn't then the application fails.

In the get function:
$cookie .= getCookie($html);

Open in new window

The global variable $cookie has the returned cookie value appended to it but since no cookie value is returned then the value is unchanged so the test that is to follow will cause the application to die
die(Impossible to get  the tokens of the video');

Open in new window

We need to see what the browser is sending back to the server.

Based on what you have provided so far, there are no cookies to find.
We need to see what the browser is sending back to the server.

how to get this information ?
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh shit ! ty i have update the code to removes the user pass

new link http://pastebin.com/3v3a6w1e

i got the information on the site web  

	
	[Object { name="Host", value="website.fr"}, Object { name="User-Agent", value="Mozilla/5.0 (X11; Linux ...o/20100101 Firefox/34.0"}, Object { name="Accept", value="text/html,application/xh...ion/xml;q=0.9,*/*;q=0.8"}, 5 plus...]
	Object { name="Host", value="website.fr"}
	Object { name="User-Agent", value="Mozilla/5.0 (X11; Linux ...o/20100101 Firefox/34.0"}
	Object { name="Accept", value="text/html,application/xh...ion/xml;q=0.9,*/*;q=0.8"}
	Object { name="Accept-Language", value="fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3"}
	Object { name="Accept-Encoding", value="gzip, deflate"}
	Object { name="Cookie", value="18acd9b63ecbf50de0b8c010...=54a613640d765343189874"}
	name "Cookie"
	value  "18acd9b63ecbf50de0b8c010c2b7289f=castip4cq1lo57tq665pjju3i1; _ga=GA1.2.2127250119.1420170074; _gat=1; YWRuLWF1dGhfNTE5Ml8w=54a613640d765343189874"
	Object { name="DNT", value="1"}
	Object { name="Connection", value="keep-alive"}

Open in new window


réponse

	Object { name="Date", value="Fri, 02 Jan 2015 03:41:40 GMT"}
	       Object { name="Server", value="Apache/2.2.22 (Debian)"}
	      Object { name="X-Powered-By", value="PHP/5.4.35-0+deb7u2"}
	Object { name="p3p", value="CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM""}
	Object { name="Cache-Control", value="no-cache"}
	Object { name="Pragma", value="no-cache"}
	Object { name="Vary", value="Accept-Encoding,User-Agent"}
	Object { name="Content-Encoding", value="gzip"}
	Object { name="Content-Length", value="14123"}
	Object { name="Keep-Alive", value="timeout=5, max=99"}
	Object { name="Connection", value="Keep-Alive"}
	Object { name="Content-Type", value="text/html; charset=utf-8"

Open in new window

I have to say saddened I express myself badly in English

But what is the issue that you are having/are looking to resolve?
I just try to run the code as before

When you run the script, the items you are looking to obtain are not validating?
For the moment given information it is only that I have
if you are trying to download images, your list of images to download which is within the pngFilename variable is not being set/updated.

not  sure whether line 151  where you have the get() seemingly for the list of content it is missing the assignment to $html=get (...video .... )
see if that fixes the issue you are having.

are you trying to script a download or an upload?

as mentioned before, I do not see where you build the list of items for either one.
when was it that script worked last?  The site may have changed such that what you are looking for is not longer there.
Navigate the site to confirm that your current script continues to follow the navigation of the site.
i.e. one of the last link you think is site_URL/video is actually now site_URL/somenewthing/video

are you getting error that the videos are not there?
i trying to download files  and get  2 order information for play video on my mediacenter

I am not sure to understand im a noobs

edit : ah i look this :)
the link is not change  /video/name/id is the same  :)
Look at line 151 of the pastebin.com link you posted.  This is within the section getsecuritytokens.

I think it is missing the $html which will be used within download
it is now
151: get(SITE_URL . '/index.php?option=com_vodvideo&view=player&format=raw&video_id='.$videoId.'&load=1&date=');

but should be
151: $html=get(SITE_URL . '/index.php?option=com_vodvideo&view=player&format=raw&video_id='.$videoId.'&load=1&date=');

try the change and see if that works or not.

The difficulty is that it is not clear to me what the issue is that you are facing.

It is one thing to read through code, it is another to know how this code interacts with the site from which you want data.
sorry not work

The difficulty is that it is not clear to me what the issue is that you are facing.
I understand you I have from the difficulty to the knowledge too because I begin in the domain

It is one thing to read through code, it is another to know how this code interacts with the site from which you want data.
Not I who am made the script I also try to understand(include) and I do not manage to join his(her) creator he(it) not response not...
What is it you expect this code to do? Download images/vidoes to your system or upload them?
Or do you have a website http://www.yourdomain.com where you placed this viewcontent.php

you are accessing http://www.yourdomain.com/viewcontent.php using your TV or computer, and you click on the link


ecrive en Francais, I'll translate what I do not understand using the various tools available on the web.

Are you getting this error, "Impossible de récupérer les tokens de la vidéo sur demande" and this is the issue?
yes is the error i have Impossible de récupérer les tokens de la vidéo sur demande
The cookie==old is the reason, the script seems to look for a change in cookie.  I do not know whether it should or should not change.
Comment out lines 153-156
// in front of line 153, 154, 155 and 156
I think the process is looking for a change in the cookie data when requesting the info on line 151.
There is no way for me to know whether they used to add a cookie setting and now they stopped.
i.e. add another entry that is now not there.
je vais voir ce que je peux faire directement sur le site et vais revenir sur le sujet demain :)
I go to see what I can make directly on the site and am going to return on the subject tomorrow:)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i do not understand how to use it ?
Trying to read through all the updates.

It almost appears to me as if the PHP script is running on the client side trying to act like a browser instead of running on the server.

So hexo dark, is the script running as part of a service on a web server, or are you running this on a client?
running this on a client
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
resolved

is this line the bug resolved
$old = $cookie;

Why this line crashed the script?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
nice job