Jump to content

Jacq

Members
  • Posts

    8
  • Joined

  • Last visited

Jacq's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. My website is downlading outside website and displays on my side but when you press on the downloaded page for example on a link website is redirected to another domain. I want my site to detected when somebody is pressing the link on the downloaded site and then download this page and displayed on my website. I'm using curl to download page. So I want to detect a change of the link save a link to a variable, download the page and display on my site. $url = 'http://www.onet.pl'; // disguises the curl using fake headers and a fake user agent. function disguise_curl($url) { $curl = curl_init(); // Setup headers - I used the same headers from Firefox version 2.0.0.6 // below was split up because php.net said the line was too long. :/ $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,"; $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // browsers keep this blank. curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)'); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com'); curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($curl, CURLOPT_AUTOREFERER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 10); $html = curl_exec($curl); // execute the curl command curl_close($curl); // close the connection return $html; // and finally, return $html } // uses the function and displays the text off the website $text = disguise_curl($url); echo $text;
  2. Welcome How to remove characters from the result. When I try to delete characters I have error Code: function getInbetweenStrings($start, $end, $str){ $regex = "/$start([a-zA-Z0-9_]*)$end/"; preg_match_all($regex, $str, $matches); return $matches[1]; } $text ='<input type="hidden" name="elementId" value="1826" id="elementId">'; $str = $text; $str_arr = getInbetweenStrings('<input type="hidden" name="elementId" value="', '" id="elementId">', $str); print_r($str_arr); The result of this code looks like this Array ( [0] => 1826 ) I just want 1826 and when i change print_r($str_arr); to echo $str_arr; then code writes me just Array not even Array ( [0] => 1826 ). Do you have any advice on the code
  3. Help me with this code: <?php // Hide errors $oldSetting = libxml_use_internal_errors( true ); libxml_clear_errors(); // Instantiate domdocument so we can fetch the html $dom = new DOMDocument(); $dom->loadHTMLFile('http://www.btvguide.com/Keeping-Up-with-the-Kardashians'); // put your website to scrape here // Instantiate domxpath to perform query so we can search an html element by their ids/classname. $xpath = new DOMXPath($dom); // This query will find all the <input type="hidden"> // use "//input[@id=elementid]" if you want to search by their id $entries = $xpath->query("//input[@id=elementid]"); // Loop through each result then get the "value" attribute foreach ($entries as $entry) { echo $entry->getAttribute('value') . '<br>'; } libxml_clear_errors(); libxml_use_internal_errors( $oldSetting ); echo $entry; ?> This code doesn't work.
  4. How to add this numer result to a link. So I want to get the html code of website to a variable and then I want to read the value of a single line in the whole code using the id in this case I want numer (7548) and then insert this numer to the variable and then i want connect link with variable www.example.com/z where {z} is a variable in this case numer 7548 then I want create variable using this to parts www.example.com/ and z I want the whole code to be activated when I press button. Please help
  5. Welcome I would like to have on website a form that is part of the site where i can write name and link and choose the column in which the link will be displayed when you press the button site should to saved information to the database. Then the page should loads it to the menu as a link such as a column (empty) column b, (my link appears when you press the b column in drop-down menu). How to do it?
  6. My question is how to get the html code of for example www.example.com and then read the value of one line using the id. <input type="hidden" name="elementId" value="7548" id="elementId"> So I want to get the html code of website to a variable and then I want to read the value of a single line in the whole code using the id in this case I want numer (7548) and then insert this numer to the variable and then i want connect link with variable www.example.com/z where {z} is a variable in this case numer 7548 then I want create variable using this to parts www.example.com/ and z I want the whole code to be activated when I press button. Please help
  7. Welcome I would like to create a link URL or script that will be assigned to a button on my website, but when pressed will open the outside website and pressed button on this site. This button on the outside website is not assigned to link button is assigned to function and this is a problem for me. I made a url link that is writing on the outside website text "username" in form http://www.weeb.tv/account/login&username=username I want to do something like this but instead of typing I want to press the button using the url link or script. This is a sample page and button code Page: http://www.tvmuse.eu/tv-shows/Grimm_27159/season_2/episode_20/ Button code: <button class="btn btn_light" id="btn_wlist" onclick="sendAction('6')"><span><em class="i_subscribe"> </em>Add TV Show to Watchlist</span></button> Is it possible to click the button using the id or something. Please help
×
×
  • 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.