Note that there are some explanatory texts on larger screens.

plurals
  1. POphp curl, link label modifying through proxy website, not fully working
    primarykey
    data
    text
    <p>Here is the code</p> <pre><code>&lt;?php $url='http://isrc.ulster.ac.uk'; $var = fread_url($url);// function calling to get the page from curl $i=0; $linklabel = array(); $linklabelmod = array(); $link = array(); $dom = new DOMDocument(); @$dom-&gt;loadHTML($var); $xpath = new DOMXPath($dom); foreach($xpath-&gt;query('//a') as $element) { $linklabel[] = $element-&gt;textContent; $link[] = $element-&gt;getAttribute("href"); $i=$i+1; } for($k=0;$k&lt;$i;$k++) { $linklabelmod[$k] = str_replace($linklabel[$k], $linklabel[$k]."[$k]", $linklabel[$k]); $var = preg_replace( "/\\Q$linklabel[$k]\\E/", $linklabelmod[$k], $var, 1 );//modifying link labels } print $var; function fread_url($url){ if(function_exists("curl_init")){ $ch = curl_init(); $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; "."Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt( $ch, CURLOPT_HTTPGET, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); $html = curl_exec($ch); //print $html;//will printing the web page . curl_close($ch); } else{ $hfile = fopen($url,"r"); if($hfile){ while(!feof($hfile)){ $html.=fgets($hfile,1024); } } } return $html; } ?&gt; </code></pre> <p>Not all link labels are changing. I want each link label to be modified by attaching a unique number. Plz run the code so that you can see error.. Thx in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload