Saturday 31 October 2015

how to use Curl Fatch data in other website

<?php

function curl_download($Url){
 
    if (!function_exists('curl_init')){
        die('cURL is not installed. Install and try again.');
    }
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $Url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    $start = strpos($output, '<h2 id="logo">cfghvbbv</h2>');
$end = strpos($output, '<p>', $start);
$length = $end-$start;
$output = substr($output, $start, $length);
   
   
   
   
 
    return $output;
}

print curl_download('http://www.gutenberg.org/browse/scores/top');

?>

Web Service in php

<?php 
  /* soak in the passed variable or set our own */
  $format = strtolower($_GET['format']) == 'json' ? 'json' : 'xml'; //xml is the default
  /* connect to the db */
  $link = mysql_connect('localhost','envisiy9_update','T?pAT*{nC58E') or die('Cannot connect to the DB');
  mysql_select_db('envisiy9_SiteCMS',$link) or die('Cannot select the DB');
  /* grab the posts from the db */
  $query = "SELECT * FROM artists";
  $result = mysql_query($query,$link) or die('Errant query:  '.$query);
  /* create one master array of the records */
  $posts = array();
  if(mysql_num_rows($result)) {
    while($post = mysql_fetch_assoc($result)) {
      $posts[] = array('a_id'=>$post['a_id'],'artist_name'=>htmlentities($post['artist_name']));
    }
  }
  /* output in necessary format */
  if($format == 'json') {
   header('Content-type: application/json');
    echo json_encode(array('posts'=>$posts));
  }
  else {
    //header('Content-type: text/xml');
    echo '';
    foreach($posts as $index => $post) {
      if(is_array($post)) {
        foreach($post as $key => $value) {
          echo '<',$key,'>';
          if(is_array($value)) {
            foreach($value as $tag => $val) {
              echo '<',$tag,'>',htmlentities($val),'</',$tag,'>';
            }
          }
          echo '</',$key,'>';
        }
      }
    }
    echo '';
  }
  /* disconnect from the db */

?>


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

web service 2:

<?php 
  $link = mysql_connect('localhost','root','') or die('Cannot connect to the DB');
  mysql_select_db('angelfi4_cart',$link) or die('Cannot select the DB');
  /* grab the posts from the db */
  $query = "SELECT * FROM artists";
  $result = mysql_query($query,$link) or die('Errant query:  '.$query);
  /* create one master array of the records */
  $posts = array();
   $arts =array();
  if(mysql_num_rows($result)) {
    while($post = mysql_fetch_assoc($result)) {
   
     $query2 = "SELECT * FROM art where artist='".$post['a_id']."'";
     $result2 = mysql_query($query2,$link) or die('Errant query:  '.$query2);
    while($art = mysql_fetch_assoc($result2)) {
      $arts[] = array('image'=>'http://69.195.124.130/~envisiy9/manager/pictures/'.$art['image'],'price'=>htmlentities($art['price']),'title'=>htmlentities($art['title']),'dimensions'=>htmlentities($art['dimensions']));
    }

     $posts[] = array('a_id'=>$post['a_id'],'artist_name'=>htmlentities($post['artist_name']),'arts'=>$arts);
    
    }
  }
 
echo "<pre>";
print_r($posts);
 //header('Content-type: application/json');
 //echo json_encode(array('posts'=>$posts));



?>


how to create Patern of traingal

<?php


for($a=0; $a<=5; $a++)
{
for($b=1; $b<=$a; $b++)
{
echo "$b&nbsp;";
}
echo "<br>";
}


?>



Output :

 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

count code :


<?php
//$num=200;

for($i = 200; $i <= 592; $i+=8)
    {
        echo $i.',';
    }
    echo $i;
 
?>

how to get text from image

Get text from image Click here


http://www.convertimagetotext.net/imagetotextconverter.php

Thursday 15 October 2015

Website Link

  1. http://jamrockone.com/  (php)
  2. http://onlinedesigncontest.com/ (php)
  3. http://www.webdesignit.se/en/ (wordpress)
  4. http://runbeerfit.com (wordpress)