help on using curl

This is a discussion on "help on using curl" within the PHP Forum section. This forum, and the thread "help on using curl are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 3rd, 2007, 03:12
New Member
Join Date: Mar 2007
Location: phils
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
help on using curl

hi,
i wanted to accomplish these task:


1. from that webservice get a certain set of strings from the header
2. next, generate the image.

and these 2 steps will be done at the same time.

to get the header value:
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt($ch, CURLOPT_HEADER, 1);

ob_start();
curl_exec($ch);
$s=ob_get_contents();

now from the same url i want also to generate the image on the file.
if just to create the image:

$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);
now...how to combine both functions?
Reply With Quote

  #2 (permalink)  
Old Jul 3rd, 2007, 09:59
New Member
Join Date: Jan 2006
Location: Netherland
Age: 37
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: help on using curl

these are two tasks:

first get the string with cURL
second create the dynamic image with imagemagick or GD
Reply With Quote
  #3 (permalink)  
Old Jul 4th, 2007, 02:02
New Member
Join Date: Mar 2007
Location: phils
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: help on using curl

how to get the string with curl? can you give me a sample? because when i tried putting all things together:

ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $xmyurl);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
ob_start();
curl_exec($ch);
$s=ob_get_contents();
.
.
.

i cant get the image. is there a way for me to do it with curl without using imagemagick. yes we do have gd and im applying it in creating the image on the fly.
Reply With Quote
  #4 (permalink)  
Old Jul 4th, 2007, 06:44
New Member
Join Date: Jan 2006
Location: Netherland
Age: 37
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: help on using curl

Code: Select all
how to get the string with curl? can you give me a sample? because when i tried putting all things together:
after getting the page you need to parse the image information, check this tutorial:
http://www.web-development-blog.com/...reg_match_all/

note that cURL is only a function to get a remote file (thats all)

Code: Select all
i cant get the image. is there a way for me to do it with curl without using imagemagick. yes we do have gd and im applying it in creating the image on the fly.
if you don't like IM use the GD library, but there is no way to do that job with cURL only.
Reply With Quote
Reply

Tags
curl, image, imagepng, php

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:28.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43