Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

help with cURL

General discussions related to php

Moderators: macek, egami, gesf

help with cURL

Postby Dewilas » Wed Jan 23, 2013 12:33 pm


i need help with table of another site. I need get table value from site, not first table value but second: "SFL Omnitel taurė B grupė". How this do?
Code: Select all

$xx = "";
$cURL = curl_init();

curl_setopt($cURL, CURLOPT_URL, $xx);
curl_setopt($cURL, CURLOPT_HEADER,0);

curl_setopt($cURL, CURLOPT_COOKIESESSION, true);
$strPage = curl_exec($cURL);

$strPage = str_replace('dryzuotas', 'spalvotas', $strPage);
$strPage = str_replace('href="/komanda', 'href="', $strPage);
$strPage = str_replace(' odd', 'even', $strPage);
$strPage = str_replace(' even', 'odd', $strPage);
   $pattern = "/<(a.*?href=\"[^#])([^>]+)>/";
        $replacement = '<\\1\\2 target="_blank">';
        $strPage = preg_replace($pattern,$replacement,str_replace('target="_blank"','',$strPage));
$pattern = '#<table class="inner_table">(.+)</table>#Us';
if( preg_match($pattern, $strPage, $match) ){
    $catch = $match[1];
    echo '<table id="wp-calendar">';
    echo '<caption>SFL Omnitel taurė B grupė</caption>';
    echo $catch;
    echo '</table>';
    echo 'Could not find it';


And second question: how to show only "Vieta" "Komanda" "Varžybos" "Skirtumas" "Taškai" columns value from received table? thank you
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Jan 23, 2013 12:25 pm

Re: help with cURL

Postby satalways » Thu Jan 24, 2013 6:56 am

You can use these codes..

Code: Select all
$contents = file_get_contents("");
echo $contents;
New php-forum User
New php-forum User
Posts: 5
Joined: Thu Jan 24, 2013 6:39 am
Location: Lahore, Pakistan

Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.