Reading secure files from different domains and servers

  • 9 odgovora
  • 4.251 pregleda
Reading secure files from different domains and servers 27.06.2006. u 15:52 · pre 247 meseci #1
Pokusavam iz npr. http://2ndtdomain.com/readremote.php citati https://1stdomain.com/getxml.php i nikako ne uspevam ni sa fopen, include, niti fsockopen.
Da li je mozda slucaj da na 2nddomain nisu dobro podesene ssl/tls soket operacije kroz php, ili mozda je u pitanju openssl koji nije verifikovani-placeni.
Ili nesto, drugo, trece?
Re: Reading secure files from different domains and servers 27.06.2006. u 15:57 · pre 247 meseci #2
Da, bas je i mene to zanimalo...
Npr. kako da sa sajta example.com ucitam stranicu http://www.google.com/ ikako bi recimo na vrhu stavio neki iframe, banner ili nesta slicno?
Potpis
“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
Re: Reading secure files from different domains and servers 27.06.2006. u 16:23 · pre 247 meseci #3
To bas i nema veze sa ovom temom.
Ukljuciti http stranicu u http stranicu i manipulisati s njom se razlikuje od ukljucivanja https strane u http stranu. U pitanju su dva protokola i obrada podataka sa jednog na dugome. I jos vaznije ti ne moras koristiti php da postognes to sto ti treba.
Bilo sta mozes ucitati sa iframe a ostalo je stvar (d)html umeca ... probaj u forumu web dizajn :)

Re: Reading secure files from different domains and servers 27.06.2006. u 18:29 · pre 247 meseci #4
1. Izvinjavam se zbog toga sto nisam vidio ovo s
2. Znam za iframe ali bih da vidim da li moze to da se zavrsi preko PHPa.
3. Evo otkrio sam kako da otvorim file sa drugog domaina (fopen funkcija ali treba da se fino chmoduje...)
Potpis
“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
Re: Reading secure files from different domains and servers 29.06.2006. u 12:43 · pre 247 meseci #6
Verzija na serveru (2nddomain) je 4.4.1 i ja ne administriram taj server tako da ne znam sta su radili.
A mogu ce je da i postoji bug http://bugs.php.net/bug.php?id=21653
U svakom slucaju provereno na verziji 4.4.2 radi pa bi trebali update-ovati php na poslednju 4
Mada mislim da su nesto menjali i ko zna sta radili, blokirali neke sockete ...
Re: Reading secure files from different domains and servers 30.06.2006. u 13:32 · pre 247 meseci #9
CURL - client URL

evo ti uvod iz PHP manuala

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.

These functions have been added in PHP 4.0.2.

Ja recimo koristim CURL za dohvat sadržaja s pojedinih stranica, dohvatim HTML kod čitave stranice i spremim ga kao string pa se onda dalje igram s time.

Postoji jako puno opcija i stvari koje možeš time raditi. Npr. na jednom projektu sam trebao napraviti aplikaciju koja dohvaća podatke sa stranice koja se nalazi iza logina. I onda sam napravio nešto slično ovome.

Code:

<?php
/*
This script is an example of using curl in php to log into on one page and 
then get another page passing all cookies from the first page along with you.
If this script was a bit more advanced it might trick the server into 
thinking its netscape and even pass a fake referer, yo look like it surfed 
from a local page.
*/

$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");
curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/checkpwd.asp");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "UserID=username&password=passwd");

ob_start();      // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean();  // stop preventing output

curl_close ($ch);
unset($ch);

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName");
curl_setopt($ch, CURLOPT_URL,"http://www.myterminal.com/list.asp");

$buf2 = curl_exec ($ch);

curl_close ($ch);

echo "<PRE>".htmlentities($buf2);
?>


Tu sam uspio raditi i sa https-om.

Pogledaj u PHP manual, na google upiši "PHP CURL" pa malo pročitaj što ima.

Evo ti neki od linkova:

http://curl.haxx.se/libcurl/php/
http://blog.unitedheroes.net/curl/
http://www.phpfreaks.com/tutorials/49/1.php

Potpis
http://www.zgflex.org
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme