Jump to content

problem in reading an external web page


AladdinMhaimeed

Recommended Posts

here is the code for curl:

 

<?php
$url = "http://www.tadawul.com.sa/wps/portal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_4AI/_s.7_0_A/7_0_4AI";
$ch = curl_init($url);    // initialize curl handle
//curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
//curl_setopt($ch, CURLOPT_FAILONERROR, 1);              // Fail on errors
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);    // allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_PORT, 80);            //Set the port number
curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s
curl_setopt($ch, CURLOPT_HEADER, true);

$document = curl_exec($ch);

echo "<pre>".$document."</pre>";
exit;
?>

 

and here is the one for socket:

<?php
$fp = fsockopen("http://www.tadawul.com.sa/wps/portal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_4AI/_s.7_0_A/7_0_4AI", 80, $errno, $errstr, 300);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    $out = "GET / HTTP/1.1\r\n";
    $out .= "Host: http://www.tadawul.com.sa/wps/portal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_4AI/_s.7_0_A/7_0_4AI\r\n";
    $out .= "Connection: Close\r\n\r\n";

    fwrite($fp, $out);
    while (!feof($fp)) {
        echo "<pre>". fgets($fp, 128)."</pre>";
    }
    fclose($fp);
}
?> 

Link to comment
Share on other sites

thank you very much,

actually I dont have a permission,

but when I try to scrap this page on the same domain and server, i have no problem, and read it in almost whatever method.

http://www.tadawul.com.sa/Resources/Reports/DailyList_ar.html

 

how can I figure out whether I need a permission or not?

if the answer is that I need one, then can I use a work around? after all, the page is open to read via http, and there must be a way to read it.

what do you think,

 

Link to comment
Share on other sites

Tadawul claims all copyright and intellectual property rights in all content on this website and in the underlying coding, or has the permission of the owner of those rights to use the content on this website.

 

The names of all products and services mentioned on this website are the trademarks of their owners.

 

your need to speak to them..

 

can it be done, without their permission,

yes.. but i won't be party to that.. (sorry, if i blocked it mean i don't want leachers)

 

proof of concept

leachingfb6.jpg

 

Link to comment
Share on other sites

its basically a .htaccess mod,

it checks a few things,

 

Oh @@@@ it..

 

they can still block your server IP, so don't leach like mad..

 

<?php
$URL = "http://www.tadawul.com.sa/wps/portal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_4AI/_s.7_0_A/7_0_4AI";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 1); // Get the header
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FILETIME, true);

curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_REFERER,""); //Clear REFERER
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"); //Fake Client

$data = curl_exec($ch);
curl_close($ch); 

echo $data;
?>

 

Link to comment
Share on other sites

use it as needed but remember, if you was the admin of that site and wanted block leachers, its a pain when someone finds a way to continue, theirs a few more things they can do to protect themselfs but still..

they have something inplace to make it hard to leach which to me means they don't want leachers..

 

ok i yapping now..

use as needed

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.